package com.jl.jlapp.mvp.activity;

import android.app.ProgressDialog;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.res.Resources;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.LinearLayoutCompat;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;

import butterknife.BindView;
import butterknife.ButterKnife;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseQuickAdapter.OnItemChildClickListener;
import com.jl.jlapp.R;
import com.jl.jlapp.adapter.WriteOrderGoodsMsgAdapter;
import com.jl.jlapp.eneity.ActivitysAndCouponsByGoodsMsgModel;
import com.jl.jlapp.eneity.ActivitysAndCouponsByGoodsMsgModel.ResultDataBean.ActivitysBean;
import com.jl.jlapp.eneity.ActivitysAndCouponsByGoodsMsgModel.ResultDataBean.ActivitysBean.ActivityInformationBean;
import com.jl.jlapp.eneity.ActivitysAndCouponsByGoodsMsgModel.ResultDataBean.ActivitysBean.UserCouponMsgListBean;
import com.jl.jlapp.eneity.ActivitysAndCouponsByGoodsMsgModel.ResultDataBean.ActivitysBean.UserCouponMsgListBean.UserCouponsBeanX;
import com.jl.jlapp.eneity.ActivitysAndCouponsByGoodsMsgModel.ResultDataBean.ActivitysBean.UserCouponMsgListBean.UserCouponsBeanX.CouponInformationBeanX;
import com.jl.jlapp.eneity.ActivitysAndCouponsByGoodsMsgModel.ResultDataBean.CouponsBean;
import com.jl.jlapp.eneity.ActivitysAndCouponsByGoodsMsgModel.ResultDataBean.CouponsBean.UserCouponsBean;
import com.jl.jlapp.eneity.ActivitysAndCouponsByGoodsMsgModel.ResultDataBean.CouponsBean.UserCouponsBean.CouponInformationBean;
import com.jl.jlapp.eneity.DecisionInventoryResultModel;
import com.jl.jlapp.eneity.GoodsDetailModel;
import com.jl.jlapp.eneity.GoodsDetailModel.ResultDataBean;
import com.jl.jlapp.eneity.GoodsDetailModel.ResultDataBean.GoodsActivitysBean;
import com.jl.jlapp.eneity.GoodsDetailModel.ResultDataBean.GoodsSpecificationDetailsBean;
import com.jl.jlapp.eneity.GoodsDetailModel.ResultDataBean.GoodsSpecificationDetailsBean.GoodsDisplayPicturesBean;
import com.jl.jlapp.eneity.InsertOrderResultModel;
import com.jl.jlapp.eneity.OrderTable;
import com.jl.jlapp.eneity.OrderTable.InvoiceBean;
import com.jl.jlapp.eneity.OrderTable.OfflinePaymentBean;
import com.jl.jlapp.eneity.OrderTable.OrderDetailsBean;
import com.jl.jlapp.eneity.ParamForGetActivitysAndCouponsByGoodsMsg;
import com.jl.jlapp.eneity.ParamForGetActivitysAndCouponsByGoodsMsg.GoodsMsgListBean;
import com.jl.jlapp.eneity.ParamForGetActivitysAndCouponsByGoodsMsg.GoodsMsgListBean.GoodsActivityListBean;
import com.jl.jlapp.eneity.ParamForGetActivitysAndCouponsByGoodsMsg.GoodsMsgListBean.GoodsSpeActivityListBean;
import com.jl.jlapp.eneity.PostageModel;
import com.jl.jlapp.eneity.ShipAddressModel;
import com.jl.jlapp.eneity.ShoppingCartModel;
import com.jl.jlapp.eneity.ShoppingCartModel.ResultDataBean.GoodsDetailsBean;
import com.jl.jlapp.eneity.ShoppingCartModel.ResultDataBean.GoodsDetailsBean.GoodsActivitysBeanX;
import com.jl.jlapp.eneity.ShoppingCartModel.ResultDataBean.GoodsDetailsBean.GoodsActivitysBeanX.ActivityInformationBeanX;
import com.jl.jlapp.nets.Api;
import com.jl.jlapp.nets.CommonObserver;
import com.jl.jlapp.nets.Net;
import com.jl.jlapp.nets.Transformer;
import com.jl.jlapp.popu.ChooseSendToTimePopu;
import com.jl.jlapp.popu.ChooseSendToTimePopu.OnClickBottomOKBtn;
import com.jl.jlapp.popu.ModifyNumPopu;
import com.jl.jlapp.popu.ModifyNumPopu.OnClickOkBtn;
import com.jl.jlapp.popu.OrderChooseGoodsActivityPopu;
import com.jl.jlapp.popu.OrderChooseGoodsActivityPopu.OnClickActivityItem;
import com.jl.jlapp.popu.OrderPromptPopu;
import com.jl.jlapp.popu.PaymentTypePopu;
import com.jl.jlapp.utils.CustomLanearLayoutManager;
import com.jl.jlapp.utils.SuperTextView;
import com.jl.jlapp.utils.Tools;

import io.reactivex.Flowable;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.schedulers.Schedulers;

import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class OrderSubmitActivity extends AppCompatActivity
        implements OnClickListener, OrderChooseGoodsActivityPopu.OnClickActivityItem, ChooseSendToTimePopu.OnClickBottomOKBtn, ModifyNumPopu.OnClickOkBtn {
    public static final String TAG = "OrderSubmitActivity";
    public static List<ShoppingCartModel.ResultDataBean> shouldBuyShoppingCartList = new ArrayList();
    public static List<ActivitysAndCouponsByGoodsMsgModel.ResultDataBean.CouponsBean> shouldShowCouponsBeanList = new ArrayList();
    int activityId = 0;
    int activityInformationId = 0;
    int activityType = -1;
    List<ActivitysAndCouponsByGoodsMsgModel.ResultDataBean.ActivitysBean> activitysBeanList = new ArrayList();
    OrderTable addOrderModel;
    double afterActivityTotalMoney = 0.0D;
    String bankAccount = "";
    @BindView(R.id.btn_submit)
    TextView btnSubmit;
    String businessLicenseUrl = "";
    int[] buyGoodsMsg;
    int buyNumFromGoodsDetailPage = 0;
    int chooseInvoiceContentDetail = 1;
    int chooseInvoiceLookedUpType = 1;
    int chooseInvoiceType = 2;
    @BindView(R.id.choose_more_address)
    ImageView chooseMoreAddress;
    ChooseSendToTimePopu chooseSendToTimePopu;
    String cityCode = "";
    String consigneeAddress = "";
    int consigneeIsVip = 0;
    String consigneeName = "";
    String consigneeTel = "";
    String countyCode = "";
    ActivitysAndCouponsByGoodsMsgModel.ResultDataBean.CouponsBean.UserCouponsBean.CouponInformationBean couponInformationBean;
    ActivitysAndCouponsByGoodsMsgModel.ResultDataBean.CouponsBean couponsBean;
    String depositBank = "";
    DecimalFormat df;
    double discount = 0.0D;
    GoodsActivityListBean goodsActivityListBean;
    List<GoodsActivityListBean> goodsActivityListBeans;
    GoodsDetailModel.ResultDataBean goodsDetailDataBean;
    int goodsIdFromGoodsDetailPage = 0;
    GoodsMsgListBean goodsMsgListBean;
    List<GoodsMsgListBean> goodsMsgListBeans;
    int goodsPosition = 0;
    GoodsSpeActivityListBean goodsSpeActivityListBean;
    List<GoodsSpeActivityListBean> goodsSpeActivityListBeans;
    List<Integer> goodsSpeIdList = new ArrayList();
    int goodsSpecIdFromGoodsDetailPage = 0;
    List<Map<String, Object>> goodsSpecPayMoney = new ArrayList();
    List<Map<String, Object>> insufficientInventoryGoodsSpeIdList;
    InvoiceBean invoiceBean;
    int isFromWhichPage = -1;
    boolean isOkUseCoupon = true;
    int isPresell = 0;
    @BindView(R.id.ll_stv_activity)
    LinearLayoutCompat llStvActivity;
    @BindView(R.id.ll_stv_coupon)
    LinearLayoutCompat llStvCoupon;
    int mDay;
    int mMonth;
    int mYear;
    int maxNum = 0;
    private ModifyNumPopu modifyNumPopu;
    @BindView(R.id.no_address_msg)
    TextView noAddressMsg;
    List<Integer> noStockGoodsSpeIdList;
    TextView numTv;
    @BindView(R.id.offline_payer_msg)
    LinearLayout offlinePayerMsg;
    @BindView(R.id.offline_payer_name)
    EditText offlinePayerName;
    @BindView(R.id.offline_payer_phone)
    EditText offlinePayerPhone;
    OfflinePaymentBean offlinePaymentBean;
    private OrderChooseGoodsActivityPopu orderChooseGoodsActivityPopu;
    OrderDetailsBean orderDetailsBean;
    List<OrderDetailsBean> orderDetailsBeanList;
    OrderPromptPopu orderPromptPopu;
    ParamForGetActivitysAndCouponsByGoodsMsg paramForGetActivitysAndCouponsByGoodsMsg;
    int payType = 0;
    private PaymentTypePopu paymentTypePopu;
    double postage = 0.0D;
    int postagePayType = 0;
    int presellActivityId = 0;
    String presellEndTime = "";
    private ProgressDialog progressDialog;
    String provinceCode = "";
    String registeredAddress = "";
    String registeredTel = "";
    @BindView(R.id.return_btn)
    ImageView returnBtn;
    String ringCode = "";
    @BindView(R.id.rl_food_detail)
    RecyclerView rlFoodDetailRecyclerView;
    List<ShipAddressModel.ResultDataBean> shipAddressResultDataBeans;
    @BindView(R.id.shipping_people_message)
    RelativeLayout shippingPeopleMessage;
    List<ShoppingCartModel.ResultDataBean> shoppingCartList;
    List<ShoppingCartModel.ResultDataBean> shouldShowGoodsMsg;
    @BindView(R.id.stv_activity)
    SuperTextView stvActivity;
    @BindView(R.id.stv_coupon)
    SuperTextView stvCoupon;
    @BindView(R.id.stv_invoice)
    SuperTextView stvInvoice;
    @BindView(R.id.stv_istribution_time)
    SuperTextView stvIstributionTime;
    @BindView(R.id.stv_payment_type)
    SuperTextView stvPaymentType;
    String taxpayerIdentificationNumber = "";
    double thresholdPrice = 0.0D;
    double titalPrice = 0.0D;
    @BindView(R.id.tv_consignee_address)
    TextView tvConsigneeAddress;
    @BindView(R.id.tv_consignee_name)
    TextView tvConsigneeName;
    @BindView(R.id.tv_consignee_phone)
    TextView tvConsigneePhone;
    @BindView(R.id.tv_default)
    TextView tvDefault;
    @BindView(R.id.tv_freight)
    TextView tvFreight;
    @BindView(R.id.tv_freight_unit)
    TextView tvFreightUnit;
    @BindView(R.id.tv_freight_world)
    TextView tvFreightWorld;
    @BindView(R.id.tv_submit_prompt)
    TextView tvSubmitPrompt;
    @BindView(R.id.tv_total)
    TextView tvTotal;
    String unitName = "";
    int userCouponId = 0;
    double userCouponPrice = 0.0D;
    OrderTable.UserCouponsBean userCouponsBean;
    ActivitysAndCouponsByGoodsMsgModel.ResultDataBean.CouponsBean.UserCouponsBean userCouponsBean1;
    int userId = 0;
    WriteOrderGoodsMsgAdapter writeOrderGoodsMsgAdapter;

    private void getShouldBuyGoodsFromGoodsDetailPage(GoodsDetailModel.ResultDataBean paramResultDataBean) {
        shouldBuyShoppingCartList.clear();
        ShoppingCartModel.ResultDataBean localResultDataBean = new ShoppingCartModel.ResultDataBean();
        localResultDataBean.setGoodsDetailsId(paramResultDataBean.getId());
        localResultDataBean.setGoodsNum(this.buyNumFromGoodsDetailPage);
        localResultDataBean.setGoodsName(paramResultDataBean.getName());
        ShoppingCartModel.ResultDataBean.GoodsDetailsBean localGoodsDetailsBean = new ShoppingCartModel.ResultDataBean.GoodsDetailsBean();
        ArrayList localArrayList = new ArrayList();
        int i = 0;
        for (; ; ) {
            Object localObject1;
            Object localObject2;
            Object localObject3;
            if (i < paramResultDataBean.getGoodsSpecificationDetails().size()) {
                if (((GoodsDetailModel.ResultDataBean.GoodsSpecificationDetailsBean) paramResultDataBean.getGoodsSpecificationDetails().get(i)).getId() == this.goodsSpecIdFromGoodsDetailPage) {
                    localObject1 = (GoodsDetailModel.ResultDataBean.GoodsSpecificationDetailsBean) paramResultDataBean.getGoodsSpecificationDetails().get(i);
                    if (((GoodsDetailModel.ResultDataBean.GoodsSpecificationDetailsBean) localObject1).getGoodsDisplayPictures().size() > 0) {
                        localResultDataBean.setGoodsPicUrl(((GoodsDetailModel.ResultDataBean.GoodsSpecificationDetailsBean.GoodsDisplayPicturesBean) ((GoodsDetailModel.ResultDataBean.GoodsSpecificationDetailsBean) localObject1).getGoodsDisplayPictures().get(0)).getPicUrl());
                    } else {
                        localResultDataBean.setGoodsSpecificationDetailsName(((GoodsDetailModel.ResultDataBean.GoodsSpecificationDetailsBean) localObject1).getSpecifications());
                        localResultDataBean.setGoodsSpecificationDetailsId(((GoodsDetailModel.ResultDataBean.GoodsSpecificationDetailsBean) localObject1).getId());
                        localResultDataBean.setGoodsUnitlPrice(((GoodsDetailModel.ResultDataBean.GoodsSpecificationDetailsBean) localObject1).getPrice());
                        localResultDataBean.setState(0);
                        localGoodsDetailsBean.setId(paramResultDataBean.getId());
                        localGoodsDetailsBean.setKeyWord(paramResultDataBean.getKeyWord());
                        localGoodsDetailsBean.setName(paramResultDataBean.getName());
                        localGoodsDetailsBean.setZeroStock(Integer.valueOf(paramResultDataBean.getZeroStock()));
                        localObject2 = new ShoppingCartModel.ResultDataBean.GoodsDetailsBean.GoodsSpecificationDetailsBean();
                        ((ShoppingCartModel.ResultDataBean.GoodsDetailsBean.GoodsSpecificationDetailsBean) localObject2).setId(((GoodsDetailModel.ResultDataBean.GoodsSpecificationDetailsBean) localObject1).getId());
                        ((ShoppingCartModel.ResultDataBean.GoodsDetailsBean.GoodsSpecificationDetailsBean) localObject2).setGoodsId(((GoodsDetailModel.ResultDataBean.GoodsSpecificationDetailsBean) localObject1).getGoodsId());
                        ((ShoppingCartModel.ResultDataBean.GoodsDetailsBean.GoodsSpecificationDetailsBean) localObject2).setGxcGoodsState(((GoodsDetailModel.ResultDataBean.GoodsSpecificationDetailsBean) localObject1).getGxcGoodsState());
                        ((ShoppingCartModel.ResultDataBean.GoodsDetailsBean.GoodsSpecificationDetailsBean) localObject2).setGxcGoodsStock(((GoodsDetailModel.ResultDataBean.GoodsSpecificationDetailsBean) localObject1).getGxcGoodsStock());
                        ((ShoppingCartModel.ResultDataBean.GoodsDetailsBean.GoodsSpecificationDetailsBean) localObject2).setGxcPurchase(((GoodsDetailModel.ResultDataBean.GoodsSpecificationDetailsBean) localObject1).getGxcPurchase());
                        ((ShoppingCartModel.ResultDataBean.GoodsDetailsBean.GoodsSpecificationDetailsBean) localObject2).setIdentifier(((GoodsDetailModel.ResultDataBean.GoodsSpecificationDetailsBean) localObject1).getIdentifier());
                        ((ShoppingCartModel.ResultDataBean.GoodsDetailsBean.GoodsSpecificationDetailsBean) localObject2).setPrice(((GoodsDetailModel.ResultDataBean.GoodsSpecificationDetailsBean) localObject1).getPrice());
                        ((ShoppingCartModel.ResultDataBean.GoodsDetailsBean.GoodsSpecificationDetailsBean) localObject2).setSpecifications(((GoodsDetailModel.ResultDataBean.GoodsSpecificationDetailsBean) localObject1).getSpecifications());
                        ((ShoppingCartModel.ResultDataBean.GoodsDetailsBean.GoodsSpecificationDetailsBean) localObject2).setState(((GoodsDetailModel.ResultDataBean.GoodsSpecificationDetailsBean) localObject1).getState());
                        localObject3 = new ArrayList();
                        new ShoppingCartModel.ResultDataBean.GoodsDetailsBean.GoodsSpecificationDetailsBean.GoodsActivitysBean();
                        i = 0;
                        while (i < ((GoodsDetailModel.ResultDataBean.GoodsSpecificationDetailsBean) localObject1).getGoodsActivitys().size()) {
                            ShoppingCartModel.ResultDataBean.GoodsDetailsBean.GoodsSpecificationDetailsBean.GoodsActivitysBean localGoodsActivitysBean = new ShoppingCartModel.ResultDataBean.GoodsDetailsBean.GoodsSpecificationDetailsBean.GoodsActivitysBean();
                            Object localObject4 = (GoodsDetailModel.ResultDataBean.GoodsActivitysBean) ((GoodsDetailModel.ResultDataBean.GoodsSpecificationDetailsBean) localObject1).getGoodsActivitys().get(i);
                            localGoodsActivitysBean.setActivityInformationId(((GoodsDetailModel.ResultDataBean.GoodsActivitysBean) localObject4).getActivityInformationId());
                            localGoodsActivitysBean.setGoodsId(((GoodsDetailModel.ResultDataBean.GoodsActivitysBean) localObject4).getGoodsId());
                            localGoodsActivitysBean.setId(((GoodsDetailModel.ResultDataBean.GoodsActivitysBean) localObject4).getIdX());
                            localGoodsActivitysBean.setState(((GoodsDetailModel.ResultDataBean.GoodsActivitysBean) localObject4).getState());
                            localObject4 = new ShoppingCartModel.ResultDataBean.GoodsDetailsBean.GoodsSpecificationDetailsBean.GoodsActivitysBean.ActivityInformationBean();
                            GoodsDetailModel.ResultDataBean.GoodsActivitysBean.ActivityInformationBean localActivityInformationBean = ((GoodsDetailModel.ResultDataBean.GoodsActivitysBean) ((GoodsDetailModel.ResultDataBean.GoodsSpecificationDetailsBean) localObject1).getGoodsActivitys().get(i)).getActivityInformation();
                            if (localActivityInformationBean != null) {
                                ((ShoppingCartModel.ResultDataBean.GoodsDetailsBean.GoodsSpecificationDetailsBean.GoodsActivitysBean.ActivityInformationBean) localObject4).setActivityType(localActivityInformationBean.getActivityType());
                                ((ShoppingCartModel.ResultDataBean.GoodsDetailsBean.GoodsSpecificationDetailsBean.GoodsActivitysBean.ActivityInformationBean) localObject4).setBeginValidityTime(localActivityInformationBean.getBeginValidityTime());
                                ((ShoppingCartModel.ResultDataBean.GoodsDetailsBean.GoodsSpecificationDetailsBean.GoodsActivitysBean.ActivityInformationBean) localObject4).setDiscount(localActivityInformationBean.getDiscount());
                                ((ShoppingCartModel.ResultDataBean.GoodsDetailsBean.GoodsSpecificationDetailsBean.GoodsActivitysBean.ActivityInformationBean) localObject4).setEndValidityTime(localActivityInformationBean.getEndValidityTime());
                                ((ShoppingCartModel.ResultDataBean.GoodsDetailsBean.GoodsSpecificationDetailsBean.GoodsActivitysBean.ActivityInformationBean) localObject4).setId(localActivityInformationBean.getIdX());
                                ((ShoppingCartModel.ResultDataBean.GoodsDetailsBean.GoodsSpecificationDetailsBean.GoodsActivitysBean.ActivityInformationBean) localObject4).setIdentifier(localActivityInformationBean.getIdentifier());
                                ((ShoppingCartModel.ResultDataBean.GoodsDetailsBean.GoodsSpecificationDetailsBean.GoodsActivitysBean.ActivityInformationBean) localObject4).setName(localActivityInformationBean.getNameX());
                                ((ShoppingCartModel.ResultDataBean.GoodsDetailsBean.GoodsSpecificationDetailsBean.GoodsActivitysBean.ActivityInformationBean) localObject4).setPrice(localActivityInformationBean.getPrice());
                                ((ShoppingCartModel.ResultDataBean.GoodsDetailsBean.GoodsSpecificationDetailsBean.GoodsActivitysBean.ActivityInformationBean) localObject4).setMaxNum(localActivityInformationBean.getMaxNum());
                                ((ShoppingCartModel.ResultDataBean.GoodsDetailsBean.GoodsSpecificationDetailsBean.GoodsActivitysBean.ActivityInformationBean) localObject4).setState(4);
                            }
                            localGoodsActivitysBean.setActivityInformation((ShoppingCartModel.ResultDataBean.GoodsDetailsBean.GoodsSpecificationDetailsBean.GoodsActivitysBean.ActivityInformationBean) localObject4);
                            ((List) localObject3).add(localGoodsActivitysBean);
                            i += 1;
                        }
                        localResultDataBean.setGoodsPicUrl("");
                    }
                }
            } else {
                localGoodsDetailsBean.setGoodsSpecificationDetails(localArrayList);
                localArrayList = new ArrayList();
                if (paramResultDataBean.getGoodsActivitysX().size() <= 0) {
                    break;
                }
                i = 0;
                while (i < paramResultDataBean.getGoodsActivitysX().size()) {
                    localObject3 = (GoodsDetailModel.ResultDataBean.GoodsActivitysBean) paramResultDataBean.getGoodsActivitysX().get(i);
                    localObject1 = new ShoppingCartModel.ResultDataBean.GoodsDetailsBean.GoodsActivitysBeanX();
                    ((ShoppingCartModel.ResultDataBean.GoodsDetailsBean.GoodsActivitysBeanX) localObject1).setActivityInformationId(((GoodsDetailModel.ResultDataBean.GoodsActivitysBean) localObject3).getActivityInformationId());
                    ((ShoppingCartModel.ResultDataBean.GoodsDetailsBean.GoodsActivitysBeanX) localObject1).setGoodsId(((GoodsDetailModel.ResultDataBean.GoodsActivitysBean) localObject3).getGoodsId());
                    ((ShoppingCartModel.ResultDataBean.GoodsDetailsBean.GoodsActivitysBeanX) localObject1).setId(((GoodsDetailModel.ResultDataBean.GoodsActivitysBean) localObject3).getIdX());
                    ((ShoppingCartModel.ResultDataBean.GoodsDetailsBean.GoodsActivitysBeanX) localObject1).setState(((GoodsDetailModel.ResultDataBean.GoodsActivitysBean) localObject3).getState());
                    localObject2 = new ShoppingCartModel.ResultDataBean.GoodsDetailsBean.GoodsActivitysBeanX.ActivityInformationBeanX();
                    localObject3 = ((GoodsDetailModel.ResultDataBean.GoodsActivitysBean) localObject3).getActivityInformation();
                    if (localObject3 != null) {
                        ((ShoppingCartModel.ResultDataBean.GoodsDetailsBean.GoodsActivitysBeanX.ActivityInformationBeanX) localObject2).setActivityType(((GoodsDetailModel.ResultDataBean.GoodsActivitysBean.ActivityInformationBean) localObject3).getActivityType());
                        ((ShoppingCartModel.ResultDataBean.GoodsDetailsBean.GoodsActivitysBeanX.ActivityInformationBeanX) localObject2).setBeginValidityTime(((GoodsDetailModel.ResultDataBean.GoodsActivitysBean.ActivityInformationBean) localObject3).getBeginValidityTime());
                        ((ShoppingCartModel.ResultDataBean.GoodsDetailsBean.GoodsActivitysBeanX.ActivityInformationBeanX) localObject2).setDiscount(((GoodsDetailModel.ResultDataBean.GoodsActivitysBean.ActivityInformationBean) localObject3).getDiscount());
                        ((ShoppingCartModel.ResultDataBean.GoodsDetailsBean.GoodsActivitysBeanX.ActivityInformationBeanX) localObject2).setEndValidityTime(((GoodsDetailModel.ResultDataBean.GoodsActivitysBean.ActivityInformationBean) localObject3).getEndValidityTime());
                        ((ShoppingCartModel.ResultDataBean.GoodsDetailsBean.GoodsActivitysBeanX.ActivityInformationBeanX) localObject2).setId(((GoodsDetailModel.ResultDataBean.GoodsActivitysBean.ActivityInformationBean) localObject3).getIdX());
                        ((ShoppingCartModel.ResultDataBean.GoodsDetailsBean.GoodsActivitysBeanX.ActivityInformationBeanX) localObject2).setIdentifier(((GoodsDetailModel.ResultDataBean.GoodsActivitysBean.ActivityInformationBean) localObject3).getIdentifier());
                        ((ShoppingCartModel.ResultDataBean.GoodsDetailsBean.GoodsActivitysBeanX.ActivityInformationBeanX) localObject2).setName(((GoodsDetailModel.ResultDataBean.GoodsActivitysBean.ActivityInformationBean) localObject3).getNameX());
                        ((ShoppingCartModel.ResultDataBean.GoodsDetailsBean.GoodsActivitysBeanX.ActivityInformationBeanX) localObject2).setPrice(((GoodsDetailModel.ResultDataBean.GoodsActivitysBean.ActivityInformationBean) localObject3).getPrice());
                        ((ShoppingCartModel.ResultDataBean.GoodsDetailsBean.GoodsActivitysBeanX.ActivityInformationBeanX) localObject2).setMaxNum(((GoodsDetailModel.ResultDataBean.GoodsActivitysBean.ActivityInformationBean) localObject3).getMaxNum());
                        ((ShoppingCartModel.ResultDataBean.GoodsDetailsBean.GoodsActivitysBeanX.ActivityInformationBeanX) localObject2).setState(4);
                    }
                    ((ShoppingCartModel.ResultDataBean.GoodsDetailsBean.GoodsActivitysBeanX) localObject1).setActivityInformation((ShoppingCartModel.ResultDataBean.GoodsDetailsBean.GoodsActivitysBeanX.ActivityInformationBeanX) localObject2);
                    localArrayList.add(localObject1);
                    i += 1;
                }
            }
            i += 1;
        }
        localGoodsDetailsBean.setGoodsActivitys(localArrayList);
        localResultDataBean.setGoodsDetails(localGoodsDetailsBean);
        shouldBuyShoppingCartList.add(localResultDataBean);
        saveMsgToGetAvticityAndCoupon(shouldBuyShoppingCartList);
    }

    private void getShouldBuyGoodsFromShopCart() {
        shouldBuyShoppingCartList.clear();
        if (this.shoppingCartList.size() > 0) {
            int i = 0;
            if (i < this.buyGoodsMsg.length) {
                int j = 0;
                for (; ; ) {
                    if (j < this.shoppingCartList.size()) {
                        if (((ShoppingCartModel.ResultDataBean) this.shoppingCartList.get(j)).getId() == this.buyGoodsMsg[i]) {
                            shouldBuyShoppingCartList.add(this.shoppingCartList.get(j));
                        }
                    } else {
                        i += 1;
                        break;
                    }
                    j += 1;
                }
            }
            saveMsgToGetAvticityAndCoupon(shouldBuyShoppingCartList);
            return;
        }
        Toast.makeText(this, "抱歉，数据出错啦!", Toast.LENGTH_SHORT).show();
    }

    private OrderTable noGoodsStockOrInsufficientInventory(OrderTable paramOrderTable) {
        int j;
        label191:
        label840:
        for (int i = 0; i < paramOrderTable.getOrderDetails().size(); i = j + 1) {
            int k = 0;
            j = i;
            if (k < this.noStockGoodsSpeIdList.size()) {
                if (((Integer) this.noStockGoodsSpeIdList.get(k)).intValue() == ((OrderDetailsBean) paramOrderTable.getOrderDetails().get(i)).getGoodsSpecificationDetailsId()) {
                    paramOrderTable.getOrderDetails().remove(i);
                    j = i - 1;
                }
            } else {
                i = 0;
            }
            for (; ; ) {
                if (i >= this.insufficientInventoryGoodsSpeIdList.size()) {
                    break label840;
                }
                if (((Integer) ((Map) this.insufficientInventoryGoodsSpeIdList.get(i)).get("goodsSpecId")).intValue() == ((OrderDetailsBean) paramOrderTable.getOrderDetails().get(j)).getGoodsSpecificationDetailsId()) {
                    int m = ((Integer) ((Map) this.insufficientInventoryGoodsSpeIdList.get(i)).get("stock")).intValue();
                    k = 0;
                    if (k < this.goodsSpeIdList.size()) {
                        if (((Integer) this.goodsSpeIdList.get(k)).intValue() == ((Integer) ((Map) this.insufficientInventoryGoodsSpeIdList.get(i)).get("goodsSpecId")).intValue()) {
                            double d1 = ((OrderDetailsBean) paramOrderTable.getOrderDetails().get(j)).getGoodsOriginalPrice();
                            k += 1;
                            if (this.maxNum >= m) {
                                ((OrderDetailsBean) paramOrderTable.getOrderDetails().get(j)).setGoodsPaymentPrice(Double.parseDouble(this.df.format(m * d1 * this.discount)));
                            } else {
                                ((OrderDetailsBean) paramOrderTable.getOrderDetails().get(j)).setGoodsPaymentPrice(Double.parseDouble(this.df.format(this.maxNum * d1 * this.discount + (m - this.maxNum) * d1)));
                                if (this.maxNum >= m) {
                                    ((OrderDetailsBean) paramOrderTable.getOrderDetails().get(j)).setGoodsPaymentPrice(Double.parseDouble(this.df.format(m * this.discount)));
                                } else {
                                    ((OrderDetailsBean) paramOrderTable.getOrderDetails().get(j)).setGoodsPaymentPrice(Double.parseDouble(this.df.format(this.maxNum * this.discount + (m - this.maxNum) * d1)));
                                    if (this.maxNum >= m) {
                                        ((OrderDetailsBean) paramOrderTable.getOrderDetails().get(j)).setGoodsPaymentPrice(Double.parseDouble(this.df.format(m * this.discount)));
                                    } else {
                                        ((OrderDetailsBean) paramOrderTable.getOrderDetails().get(j)).setGoodsPaymentPrice(Double.parseDouble(this.df.format(this.maxNum * this.discount + (m - this.maxNum) * d1)));
                                        ((OrderDetailsBean) paramOrderTable.getOrderDetails().get(j)).setGoodsPaymentPrice(Double.parseDouble(this.df.format(m * d1 - this.discount)));
                                        if (m * d1 >= this.thresholdPrice) {
                                            ((OrderDetailsBean) paramOrderTable.getOrderDetails().get(j)).setGoodsPaymentPrice(Double.parseDouble(this.df.format(m * d1 - this.discount)));
                                        } else {
                                            ((OrderDetailsBean) paramOrderTable.getOrderDetails().get(j)).setGoodsPaymentPrice(Double.parseDouble(this.df.format(m * d1)));
                                        }
                                    }
                                }
                            }
                        }
                    }
                    ((OrderDetailsBean) paramOrderTable.getOrderDetails().get(j)).setGoodsQuantity(m);
                    if (this.goodsSpeIdList.size() == 0) {
                        ((OrderDetailsBean) paramOrderTable.getOrderDetails().get(j)).setGoodsPaymentPrice(Double.parseDouble(this.df.format(m * ((OrderDetailsBean) paramOrderTable.getOrderDetails().get(j)).getGoodsOriginalPrice())));
                    }
                }
                i += 1;
            }
        }
        double d2 = 0.0D;
        double d1 = 0.0D;
        for (int i = 0; i < paramOrderTable.getOrderDetails().size(); i++) {
            d2 += ((OrderDetailsBean) paramOrderTable.getOrderDetails().get(i)).getGoodsOriginalPrice() * ((OrderDetailsBean) paramOrderTable.getOrderDetails().get(i)).getGoodsQuantity();
            d1 += ((OrderDetailsBean) paramOrderTable.getOrderDetails().get(i)).getGoodsPaymentPrice();
        }
        getPostage(this.provinceCode, this.cityCode, this.countyCode, this.ringCode, d2);
        paramOrderTable.setOrderOriginalPrice(Double.parseDouble(this.df.format(d2)));
        paramOrderTable.setOrderPresentPrice(Double.parseDouble(this.df.format(d1)));
        if (d1 >= 50000.0D) {
            this.payType = 1;
            this.offlinePayerMsg.setVisibility(View.VISIBLE);
        } else {
            paramOrderTable.setPayType(this.payType);
            paramOrderTable.setPostage(this.postage);
            paramOrderTable.setPostagePayType(this.postagePayType);
            if (this.userCouponId == 0) {
            }
            if (!this.isOkUseCoupon) {
            }
            d2 = 0.0D;
            for (int i = 0; i < shouldShowCouponsBeanList.size(); i++) {
                if (((ActivitysAndCouponsByGoodsMsgModel.ResultDataBean.CouponsBean) shouldShowCouponsBeanList.get(i)).getUserCoupons().getId() == this.userCouponId) {
                    d2 = ((ActivitysAndCouponsByGoodsMsgModel.ResultDataBean.CouponsBean) shouldShowCouponsBeanList.get(i)).getUserCoupons().getCouponInformation().getUseLimit();
                }
            }
            this.payType = 0;
            this.offlinePayerMsg.setVisibility(View.GONE);
        }
        if (d2 <= d1) {
            paramOrderTable.setOrderPresentPrice(Double.parseDouble(this.df.format(paramOrderTable.getOrderPresentPrice() - this.userCouponPrice)));
            return paramOrderTable;
        }
        paramOrderTable.setIsUseCoupon(0);
        return paramOrderTable;
    }


    private void setGoodsMsgAdapter() {
        this.rlFoodDetailRecyclerView.setLayoutManager(new CustomLanearLayoutManager(this, false));
        this.writeOrderGoodsMsgAdapter = new WriteOrderGoodsMsgAdapter(R.layout.item_write_order_goods_msg, shouldBuyShoppingCartList);
        this.writeOrderGoodsMsgAdapter.setIsFromGoodsDetail(this.isFromWhichPage);
        this.writeOrderGoodsMsgAdapter.setBuyNum(this.buyNumFromGoodsDetailPage);
        this.rlFoodDetailRecyclerView.setAdapter(this.writeOrderGoodsMsgAdapter);
        this.writeOrderGoodsMsgAdapter.setOnItemChildClickListener(new OnItemChildClickListener() {
            public void onItemChildClick(BaseQuickAdapter paramAnonymousBaseQuickAdapter, View paramAnonymousView, int paramAnonymousInt) {
                OrderSubmitActivity.this.goodsPosition = paramAnonymousInt;
                OrderSubmitActivity.this.afterActivityTotalMoney = 0.0D;
                OrderSubmitActivity.this.userCouponPrice = 0.0D;
                OrderSubmitActivity.this.userCouponId = 0;
                TextView tv_reduce = (TextView) paramAnonymousView.findViewById(R.id.tv_reduce);
                ShoppingCartModel.ResultDataBean resultDataBean = OrderSubmitActivity.shouldBuyShoppingCartList.get(paramAnonymousInt);
                if ((resultDataBean.getGoodsDetails() != null) && (resultDataBean.getGoodsDetails().getGoodsSpecificationDetails().size() > 0)) {
                    paramAnonymousInt = 0;
                    if (paramAnonymousInt < resultDataBean.getGoodsDetails().getGoodsSpecificationDetails().size()) {
                        if (resultDataBean.getGoodsSpecificationDetailsId() == ((ShoppingCartModel.ResultDataBean.GoodsDetailsBean.GoodsSpecificationDetailsBean) resultDataBean.getGoodsDetails().getGoodsSpecificationDetails().get(paramAnonymousInt)).getId()) {
                            if (resultDataBean.getGoodsNum() > 1) {
                            }
                            Toast.makeText(OrderSubmitActivity.this, "不能再减少了!", Toast.LENGTH_SHORT).show();
                            tv_reduce.setTextColor(OrderSubmitActivity.this.getResources().getColor(R.color.moreText));
                        } else {
                            paramAnonymousInt += 1;
                            resultDataBean.setGoodsNum(resultDataBean.getGoodsNum() - 1);
                        }
                    }
                }
                OrderSubmitActivity.this.writeOrderGoodsMsgAdapter.notifyDataSetChanged();
                OrderSubmitActivity.this.countGoodsAllPriceFromShopCart();
                OrderSubmitActivity.this.provinceCode = ((ShipAddressModel.ResultDataBean) OrderSubmitActivity.this.shipAddressResultDataBeans.get(0)).getProvinceCode();
                OrderSubmitActivity.this.cityCode = ((ShipAddressModel.ResultDataBean) OrderSubmitActivity.this.shipAddressResultDataBeans.get(0)).getCityCode();
                OrderSubmitActivity.this.countyCode = ((ShipAddressModel.ResultDataBean) OrderSubmitActivity.this.shipAddressResultDataBeans.get(0)).getCountyCode();
                OrderSubmitActivity.this.ringCode = ((ShipAddressModel.ResultDataBean) OrderSubmitActivity.this.shipAddressResultDataBeans.get(0)).getRingCode();
                if ((OrderSubmitActivity.this.cityCode == null) || ("".equals(OrderSubmitActivity.this.cityCode))) {
                    OrderSubmitActivity.this.cityCode = "0";
                }
                OrderSubmitActivity.this.getPostage(OrderSubmitActivity.this.provinceCode, OrderSubmitActivity.this.cityCode, OrderSubmitActivity.this.countyCode, OrderSubmitActivity.this.ringCode, OrderSubmitActivity.this.titalPrice);
                OrderSubmitActivity.this.goodsSpecPayMoney.clear();
                OrderSubmitActivity.this.saveMsgToGetAvticityAndCoupon(OrderSubmitActivity.shouldBuyShoppingCartList);
                OrderSubmitActivity.this.stvCoupon.setSubTitle("请选择");
                OrderSubmitActivity.this.stvActivity.setSubTitle("请选择");
                OrderSubmitActivity.this.activityInformationId = 0;
                OrderSubmitActivity.this.activityType = -1;
            }
        });
    }

    private void setListener() {
        this.stvPaymentType.setOnClickListener(this);
        this.chooseMoreAddress.setOnClickListener(this);
        this.stvInvoice.setOnClickListener(this);
        this.stvCoupon.setOnClickListener(this);
        this.stvIstributionTime.setOnClickListener(this);
        this.stvActivity.setOnClickListener(this);
        this.btnSubmit.setOnClickListener(this);
        this.returnBtn.setOnClickListener(this);
    }

    public void OnClickOkBtn(String paramString) {
        this.modifyNumPopu.dismiss();
        this.numTv.setText(paramString);
        ShoppingCartModel.ResultDataBean localResultDataBean = (ShoppingCartModel.ResultDataBean) shouldBuyShoppingCartList.get(this.goodsPosition);
        if ((localResultDataBean.getGoodsDetails() != null) && (localResultDataBean.getGoodsDetails().getGoodsSpecificationDetails().size() > 0)) {
            int i = 0;
            while (i < localResultDataBean.getGoodsDetails().getGoodsSpecificationDetails().size()) {
                if (localResultDataBean.getGoodsSpecificationDetailsId() == ((ShoppingCartModel.ResultDataBean.GoodsDetailsBean.GoodsSpecificationDetailsBean) localResultDataBean.getGoodsDetails().getGoodsSpecificationDetails().get(i)).getId()) {
                    localResultDataBean.setGoodsNum(Integer.parseInt(paramString));
                }
                i += 1;
            }
        }
        this.writeOrderGoodsMsgAdapter.notifyDataSetChanged();
        countGoodsAllPriceFromShopCart();
        this.provinceCode = ((ShipAddressModel.ResultDataBean) this.shipAddressResultDataBeans.get(0)).getProvinceCode();
        this.cityCode = ((ShipAddressModel.ResultDataBean) this.shipAddressResultDataBeans.get(0)).getCityCode();
        this.countyCode = ((ShipAddressModel.ResultDataBean) this.shipAddressResultDataBeans.get(0)).getCountyCode();
        this.ringCode = ((ShipAddressModel.ResultDataBean) this.shipAddressResultDataBeans.get(0)).getRingCode();
        if ((this.cityCode == null) || ("".equals(this.cityCode))) {
            this.cityCode = "0";
        }
        getPostage(this.provinceCode, this.cityCode, this.countyCode, this.ringCode, this.titalPrice);
        this.goodsSpecPayMoney.clear();
        saveMsgToGetAvticityAndCoupon(shouldBuyShoppingCartList);
        this.stvActivity.setSubTitle("请选择");
        this.stvCoupon.setSubTitle("请选择");
        this.activityInformationId = 0;
        this.activityType = -1;
    }

    public void buildProgressDialog() {
        if (this.progressDialog == null) {
            this.progressDialog = new ProgressDialog(this);
            this.progressDialog.setProgressStyle(0);
        }
        this.progressDialog.setMessage("加载中");
        this.progressDialog.setCancelable(true);
        this.progressDialog.show();
    }

    public void cancelProgressDialog() {
        if ((this.progressDialog != null) && (this.progressDialog.isShowing())) {
            this.progressDialog.dismiss();
        }
    }

    public void countGoodsAllPriceFromShopCart() {
        double d = 0.0D;
        int i = 0;
        while (i < shouldBuyShoppingCartList.size()) {
            d += ((ShoppingCartModel.ResultDataBean) shouldBuyShoppingCartList.get(i)).getGoodsUnitlPrice() * ((ShoppingCartModel.ResultDataBean) shouldBuyShoppingCartList.get(i)).getGoodsNum();
            i += 1;
        }
        this.titalPrice = Double.parseDouble(this.df.format(d));
        if (this.titalPrice >= 50000.0D) {
            this.tvSubmitPrompt.setVisibility(View.VISIBLE);
            this.tvSubmitPrompt.setText(R.string.text_submit_order_money_5);
            this.stvPaymentType.setSubTitle("线下支付");
            this.offlinePayerMsg.setVisibility(View.VISIBLE);
            this.payType = 1;
            return;
        }
        if (this.isPresell == 1) {
            this.tvSubmitPrompt.setVisibility(View.VISIBLE);
        } else {
            this.stvPaymentType.setSubTitle("在线支付");
            this.offlinePayerMsg.setVisibility(View.GONE);
            this.payType = 0;
            this.tvSubmitPrompt.setVisibility(View.GONE);
        }
    }

    public void decisionInventory(OrderTable paramOrderTable) {
        this.btnSubmit.setEnabled(false);
        this.btnSubmit.setBackgroundResource(R.color.moreText);
        Net.get().decisionInventory(paramOrderTable)
                .compose(Transformer.<DecisionInventoryResultModel>switchSchedulers())
                .subscribe(new CommonObserver<DecisionInventoryResultModel>() {
                    @Override
                    protected void onError(String errorMsg) {

                    }

                    @Override
                    protected void onSuccess(DecisionInventoryResultModel decisionInventoryResultModel) {

                    }
                });
    }

    public void getActivitysAndCouponsByGoodsMsg(ParamForGetActivitysAndCouponsByGoodsMsg paramParamForGetActivitysAndCouponsByGoodsMsg) {
        Net.get().getActivitysAndCouponsByGoodsMsg(paramParamForGetActivitysAndCouponsByGoodsMsg)
                .compose(Transformer.<ActivitysAndCouponsByGoodsMsgModel>switchSchedulers())
                .subscribe(new CommonObserver<ActivitysAndCouponsByGoodsMsgModel>() {
                    @Override
                    protected void onError(String errorMsg) {

                    }

                    @Override
                    protected void onSuccess(ActivitysAndCouponsByGoodsMsgModel activitysAndCouponsByGoodsMsgModel) {

                    }
                });
    }

    public void getGoodsDetailMsgByGoodsId(int paramInt) {
        Net.get().getGoodsDetailMsgByGoodsId(paramInt)
                .compose(Transformer.<GoodsDetailModel>switchSchedulers())
                .subscribe(new CommonObserver<GoodsDetailModel>() {
                    @Override
                    protected void onError(String errorMsg) {

                    }

                    @Override
                    protected void onSuccess(GoodsDetailModel goodsDetailModel) {

                    }
                });
    }

    public void getPostage(String paramString1, String paramString2, String paramString3, String paramString4, double paramDouble) {
        Net.get().getPostage(paramString1, paramString2, paramString3, paramString4, paramDouble)
                .compose(Transformer.<PostageModel>switchSchedulers())
                .subscribe(new CommonObserver<PostageModel>() {
                    @Override
                    protected void onError(String errorMsg) {

                    }

                    @Override
                    protected void onSuccess(PostageModel postageModel) {

                    }
                });
    }

    public void getShippingAddressByUserId() {
        Net.get().getShippingAddressByUserId(this.userId)
                .compose(Transformer.<ShipAddressModel>switchSchedulers())
                .subscribe(new CommonObserver<ShipAddressModel>() {
                    @Override
                    protected void onError(String errorMsg) {

                    }

                    @Override
                    protected void onSuccess(ShipAddressModel shipAddressModel) {

                    }
                });
    }

    public void getShoppingCartByUserId(Integer paramInteger) {
        Net.get().getShoppingCart(paramInteger.intValue())
                .compose(Transformer.<ShoppingCartModel>switchSchedulers())
                .subscribe(new CommonObserver<ShoppingCartModel>() {
                    @Override
                    protected void onError(String errorMsg) {

                    }

                    @Override
                    protected void onSuccess(ShoppingCartModel shoppingCartModel) {

                    }
                });
    }

    public void insertOrder(OrderTable paramOrderTable) {
        Net.get().insertOrder(paramOrderTable)
                .compose(Transformer.<InsertOrderResultModel>switchSchedulers())
                .subscribe(new CommonObserver<InsertOrderResultModel>() {
                    @Override
                    protected void onError(String errorMsg) {

                    }

                    @Override
                    protected void onSuccess(InsertOrderResultModel insertOrderResultModel) {

                    }
                });
    }

    protected void onActivityResult(int paramInt1, int paramInt2, Intent paramIntent) {
        Log.d("aaaaaaaGoods", "onActivityResult");
        Log.d("aaaaaaaGoods", "resultCode:" + paramInt2);
        switch (paramInt2) {
            case 1:
                Log.d("aaaaaaaGoods", "address:" + paramIntent.getStringExtra("address"));
                this.consigneeAddress = paramIntent.getStringExtra("address");
                this.consigneeName = paramIntent.getStringExtra("name");
                this.consigneeTel = paramIntent.getStringExtra("phone");
                this.consigneeIsVip = paramIntent.getIntExtra("isDefault", 0);
                this.tvConsigneeAddress.setText(paramIntent.getStringExtra("address"));
                this.tvConsigneeName.setText(paramIntent.getStringExtra("name"));
                this.tvConsigneePhone.setText(paramIntent.getStringExtra("phone"));
                if (paramIntent.getIntExtra("isDefault", 0) == 1) {
                    this.tvDefault.setVisibility(View.VISIBLE);
                } else {
                    this.provinceCode = paramIntent.getStringExtra("provinceCode");
                    Log.d("aaaaaaaGoods", "onActivityResult provinceCode:" + this.provinceCode);
                    this.cityCode = paramIntent.getStringExtra("cityCode");
                    this.countyCode = paramIntent.getStringExtra("countyCode");
                    this.ringCode = paramIntent.getStringExtra("ringCode");
                    if ((this.cityCode == null) || ("".equals(this.cityCode))) {
                        this.cityCode = "0";
                    }
                    getPostage(this.provinceCode, this.cityCode, this.countyCode, this.ringCode, this.titalPrice);
                    this.tvDefault.setVisibility(View.GONE);
                }
                break;
            case 2:
                Log.d("OrderSubmitActivity", "chooseInvoiceType:" + paramIntent.getIntExtra("chooseInvoiceType", 2));
                this.chooseInvoiceType = paramIntent.getIntExtra("chooseInvoiceType", 2);
                switch (this.chooseInvoiceType) {
                    case 0:
                        this.chooseInvoiceLookedUpType = paramIntent.getIntExtra("chooseInvoiceLookedUpType", 0);
                        this.chooseInvoiceContentDetail = paramIntent.getIntExtra("chooseInvoiceContentDetail", 0);
                        if (this.chooseInvoiceLookedUpType == 0) {
                            this.unitName = paramIntent.getStringExtra("unitName");
                            this.taxpayerIdentificationNumber = paramIntent.getStringExtra("taxpayerIdentificationNumber");
                            this.stvInvoice.setSubTitle("单位");
                            return;
                        }
                        this.stvInvoice.setSubTitle("个人");
                        return;
                    case 1:
                        this.stvInvoice.setSubTitle("增值税专用发票");
                        this.chooseInvoiceContentDetail = paramIntent.getIntExtra("chooseInvoiceContentDetail", 0);
                        this.unitName = paramIntent.getStringExtra("unitName");
                        this.taxpayerIdentificationNumber = paramIntent.getStringExtra("taxpayerIdentificationNumber");
                        this.registeredAddress = paramIntent.getStringExtra("registeredAddress");
                        this.registeredTel = paramIntent.getStringExtra("registeredTel");
                        this.depositBank = paramIntent.getStringExtra("depositBank");
                        this.bankAccount = paramIntent.getStringExtra("bankAccount");
                        this.businessLicenseUrl = paramIntent.getStringExtra("businessLicenseUrl");
                        return;
                }
                this.stvInvoice.setSubTitle("不开发票");
                return;
        }
        this.userCouponPrice = paramIntent.getDoubleExtra("price", 0.0D);
        this.userCouponId = paramIntent.getIntExtra("couponId", 0);
        this.stvCoupon.setSubTitle(this.userCouponPrice + "元(" + paramIntent.getStringExtra("countMsg") + ")");
        double d1 = Double.parseDouble(this.tvTotal.getText().toString().trim());
        double d2 = Double.parseDouble(this.df.format(d1 - this.userCouponPrice));
        if (d2 <= 0.0D) {
            if (this.isPresell == 1) {
                this.tvSubmitPrompt.setVisibility(View.VISIBLE);
            } else {
                this.tvTotal.setText("0");
                this.stvPaymentType.setSubTitle("在线支付");
                this.offlinePayerMsg.setVisibility(View.GONE);
                this.payType = 0;
                this.tvSubmitPrompt.setVisibility(View.GONE);
            }
        }
        if (d1 - this.userCouponPrice > 1.0D) {
            this.tvTotal.setText(this.df.format(d1 - this.userCouponPrice) + "");
        } else {
            Log.d("aaaaaaaaaaaaaaaaaa", "tvTotal:" + this.tvTotal.getText().toString().trim());
            Log.d("aaaaaaaaaaaaaaaaaa", "price - userCouponPrice:" + d2);
            if (d2 < 50000.0D) {
            }
            this.tvSubmitPrompt.setVisibility(View.VISIBLE);
            this.tvSubmitPrompt.setText(R.string.text_submit_order_money_5);
            this.stvPaymentType.setSubTitle("线下支付");
            this.offlinePayerMsg.setVisibility(View.VISIBLE);
            this.payType = 1;
            this.tvTotal.setText(Double.parseDouble(this.df.format(d1 - this.userCouponPrice)) + "");
        }
        if (this.isPresell == 1) {
            this.tvSubmitPrompt.setVisibility(View.VISIBLE);
        } else {
            this.stvPaymentType.setSubTitle("在线支付");
            this.offlinePayerMsg.setVisibility(View.GONE);
            this.payType = 0;
            this.tvSubmitPrompt.setVisibility(View.GONE);
        }
    }

    public void onClick(View paramView) {

        this.paymentTypePopu = new PaymentTypePopu(this);
        this.paymentTypePopu.showAtLocation(findViewById(R.id.rl_submit), 17, 0, 0);
        this.chooseSendToTimePopu = new ChooseSendToTimePopu(this, this.stvIstributionTime.getSubTitle().toString().trim(), Integer.valueOf(this.isPresell), this.presellEndTime);
        this.chooseSendToTimePopu.showAtLocation(findViewById(R.id.rl_submit), 17, 0, 0);
        this.chooseSendToTimePopu.setSetOnClickBottomOKBtn(this);
        startActivityForResult(new Intent(this, ChooseAddressActivity.class), 1);
        Intent intent = new Intent(this, OrderWriteActivity.class);
        intent.putExtra("chooseInvoiceType", this.chooseInvoiceType);
        intent.putExtra("chooseInvoiceLookedUpType", this.chooseInvoiceLookedUpType);
        intent.putExtra("chooseInvoiceContentDetail", this.chooseInvoiceContentDetail);
        startActivityForResult(intent, 2);
        startActivityForResult(new Intent(this, DiscountActivity.class), 3);
        this.orderChooseGoodsActivityPopu = new OrderChooseGoodsActivityPopu(this, this.activitysBeanList, this.activityInformationId);
        this.orderChooseGoodsActivityPopu.showAtLocation(findViewById(R.id.rl_submit), 80, 0, 0);
        this.orderChooseGoodsActivityPopu.setOnClickActivityItem(this);
        buildProgressDialog();
        Tools.addActivity(this);
        if (this.shippingPeopleMessage.getVisibility() == View.VISIBLE) {
            if (shouldBuyShoppingCartList.size() > 0) {
                if ("请选择".equals(this.stvIstributionTime.getSubTitle().toString().trim())) {
                    cancelProgressDialog();
                    Toast.makeText(this, "请选择送货时间!", Toast.LENGTH_SHORT).show();
                    return;
                }
                this.addOrderModel = new OrderTable();
                this.addOrderModel.setUserId(this.userId);
                this.addOrderModel.setOrderOriginalPrice(Double.parseDouble(this.df.format(this.titalPrice)));
                this.addOrderModel.setOrderPresentPrice(Double.parseDouble(this.df.format(Double.parseDouble(this.tvTotal.getText().toString().trim()))) - this.postage);
                this.addOrderModel.setConsigneeName(this.tvConsigneeName.getText().toString().trim());
                this.addOrderModel.setConsigneeAddress(this.tvConsigneeAddress.getText().toString().trim());
                this.addOrderModel.setConsigneeTel(this.tvConsigneePhone.getText().toString().trim());
                this.addOrderModel.setPayType(this.payType);
                this.addOrderModel.setPostage(this.postage);
                this.addOrderModel.setPostagePayType(this.postagePayType);
                int i = 0;
                int j = 0;
                if (this.isPresell == 1) {
                    this.addOrderModel.setActivityId(this.presellActivityId);
                    this.orderDetailsBeanList = new ArrayList();
                    i = 0;
                    if (i < shouldBuyShoppingCartList.size()) {
                        this.orderDetailsBean = new OrderDetailsBean();
                        j = 0;
                    } else {
                        if (j < ((ShoppingCartModel.ResultDataBean) shouldBuyShoppingCartList.get(i)).getGoodsDetails().getGoodsSpecificationDetails().size()) {
                            if (((ShoppingCartModel.ResultDataBean) shouldBuyShoppingCartList.get(i)).getGoodsSpecificationDetailsId() == ((ShoppingCartModel.ResultDataBean.GoodsDetailsBean.GoodsSpecificationDetailsBean) ((ShoppingCartModel.ResultDataBean) shouldBuyShoppingCartList.get(i)).getGoodsDetails().getGoodsSpecificationDetails().get(j)).getId()) {
                                this.orderDetailsBean.setGoodsDetailsId(((ShoppingCartModel.ResultDataBean) shouldBuyShoppingCartList.get(i)).getGoodsDetailsId());
                                this.orderDetailsBean.setGoodsQuantity(((ShoppingCartModel.ResultDataBean) shouldBuyShoppingCartList.get(i)).getGoodsNum());
                                this.orderDetailsBean.setGoodsSpecificationDetailsId(((ShoppingCartModel.ResultDataBean) shouldBuyShoppingCartList.get(i)).getGoodsSpecificationDetailsId());
                                this.orderDetailsBean.setGoodsPurchasingPrice(((ShoppingCartModel.ResultDataBean.GoodsDetailsBean.GoodsSpecificationDetailsBean) ((ShoppingCartModel.ResultDataBean) shouldBuyShoppingCartList.get(i)).getGoodsDetails().getGoodsSpecificationDetails().get(j)).getGxcPurchase());
                                this.orderDetailsBean.setGoodsOriginalPrice(((ShoppingCartModel.ResultDataBean) shouldBuyShoppingCartList.get(i)).getGoodsUnitlPrice());
                                j = 0;
                            } else {
                                if (j < this.goodsSpecPayMoney.size()) {
                                    if (((Integer) ((Map) this.goodsSpecPayMoney.get(j)).get("goodsSpecId")).intValue() != ((ShoppingCartModel.ResultDataBean) shouldBuyShoppingCartList.get(i)).getGoodsSpecificationDetailsId()) {
                                    }
                                    if (((Double) ((Map) this.goodsSpecPayMoney.get(j)).get("afterActivityGoodsPrice")).doubleValue() >= 0.0D) {
                                    }
                                    this.orderDetailsBean.setGoodsPaymentPrice(0.0D);
                                } else {
                                    if (j == this.goodsSpecPayMoney.size()) {
                                        this.orderDetailsBean.setGoodsPaymentPrice(((ShoppingCartModel.ResultDataBean) shouldBuyShoppingCartList.get(i)).getGoodsUnitlPrice() * ((ShoppingCartModel.ResultDataBean) shouldBuyShoppingCartList.get(i)).getGoodsNum());
                                    }
                                    this.orderDetailsBean.setGoodsName(((ShoppingCartModel.ResultDataBean) shouldBuyShoppingCartList.get(i)).getGoodsName());
                                    this.orderDetailsBean.setGoodsCoverUrl(((ShoppingCartModel.ResultDataBean) shouldBuyShoppingCartList.get(i)).getGoodsPicUrl());
                                    this.orderDetailsBean.setGoodsSpecificationName(((ShoppingCartModel.ResultDataBean) shouldBuyShoppingCartList.get(i)).getGoodsSpecificationDetailsName());
                                    this.orderDetailsBeanList.add(this.orderDetailsBean);
                                    i += 1;
                                    this.addOrderModel.setActivityId(0);
                                    this.addOrderModel.setDeliverGoodsTime(this.stvIstributionTime.getSubTitle().toString().trim());
                                    this.orderDetailsBean.setGoodsPaymentPrice(((Double) ((Map) this.goodsSpecPayMoney.get(j)).get("afterActivityGoodsPrice")).doubleValue());
                                }
                                j += 1;
                            }
                        }
                        j += 1;
                    }
                }
                this.addOrderModel.setOrderDetails(this.orderDetailsBeanList);
                if (this.payType == 1) {
                    if ("".equals(this.offlinePayerName.getText().toString().trim())) {
                        cancelProgressDialog();
                        Toast.makeText(this, "请填写支付人姓名", Toast.LENGTH_SHORT).show();
                        return;
                    }
                    if ("".equals(this.offlinePayerPhone.getText().toString().trim())) {
                        cancelProgressDialog();
                        Toast.makeText(this, "请填写支付人联系方式", Toast.LENGTH_SHORT).show();
                        return;
                    }
                    if (!this.offlinePayerPhone.getText().toString().trim().matches("^1[34578]\\d{9}$")) {
                        cancelProgressDialog();
                        Toast.makeText(this, "请输入正确的手机号", Toast.LENGTH_SHORT).show();
                        return;
                    }
                    this.offlinePaymentBean = new OfflinePaymentBean();
                    this.offlinePaymentBean.setPayerName(this.offlinePayerName.getText().toString().trim());
                    this.offlinePaymentBean.setPayerTel(this.offlinePayerPhone.getText().toString().trim());
                    this.addOrderModel.setOfflinePayment(this.offlinePaymentBean);
                }
                if (this.chooseInvoiceType == 2) {
                    this.addOrderModel.setIsHasInvoice(0);
                    if (this.isFromWhichPage != 0) {
                    }
                    this.addOrderModel.setIsFromShoppingCart(1);
                    if (this.userCouponId != 0) {
                    }
                    this.addOrderModel.setIsUseCoupon(0);
                } else {
                    decisionInventory(this.addOrderModel);
                    this.addOrderModel.setIsHasInvoice(1);
                    this.invoiceBean = new InvoiceBean();
                    this.invoiceBean.setInvoiceType(this.chooseInvoiceType);
                    this.invoiceBean.setInvoiceContent(this.chooseInvoiceContentDetail);
                    if (this.chooseInvoiceType == 0) {
                    } else {
                        this.addOrderModel.setInvoice(this.invoiceBean);
                        this.invoiceBean.setInvoiceLookedUpType(this.chooseInvoiceLookedUpType);
                        if (this.chooseInvoiceLookedUpType == 0) {
                            this.invoiceBean.setUnitName(this.unitName);
                            this.invoiceBean.setTaxpayerIdentificationNumber(this.taxpayerIdentificationNumber);
                            this.invoiceBean.setUnitName(this.unitName);
                            this.invoiceBean.setTaxpayerIdentificationNumber(this.taxpayerIdentificationNumber);
                            this.invoiceBean.setRegisteredAddress(this.registeredAddress);
                            this.invoiceBean.setRegisteredTel(this.registeredTel);
                            this.invoiceBean.setDepositBank(this.depositBank);
                            this.invoiceBean.setBankAccount(this.bankAccount);
                            this.invoiceBean.setBusinessLicenseUrl(this.businessLicenseUrl);
                        }
                    }
                    this.addOrderModel.setIsFromShoppingCart(0);
                    this.addOrderModel.setIsUseCoupon(1);
                    this.userCouponsBean = new OrderTable.UserCouponsBean();
                    this.userCouponsBean.setId(this.userCouponId);
                    this.addOrderModel.setUserCoupons(this.userCouponsBean);
                }
            }
            cancelProgressDialog();
            Toast.makeText(this, "抱歉，信息错误。", Toast.LENGTH_SHORT).show();
            return;
        }
        cancelProgressDialog();
        Toast.makeText(this, "暂无收货地址，不能提交订单。", Toast.LENGTH_SHORT).show();
    }

    public void onClickActivityItem(int paramInt) {
        this.activityInformationId = paramInt;
        this.afterActivityTotalMoney = 0.0D;
        this.goodsSpecPayMoney = new ArrayList();
        new HashMap();
        int i = 0;
        if (i < this.activitysBeanList.size()) {
            if (((ActivitysAndCouponsByGoodsMsgModel.ResultDataBean.ActivitysBean) this.activitysBeanList.get(i)).getActivityInformation().getId() == paramInt) {
                this.goodsSpeIdList = ((ActivitysAndCouponsByGoodsMsgModel.ResultDataBean.ActivitysBean) this.activitysBeanList.get(i)).getGoodsSpeIdList();
                this.activityType = ((ActivitysAndCouponsByGoodsMsgModel.ResultDataBean.ActivitysBean) this.activitysBeanList.get(i)).getActivityInformation().getActivityType();
                switch (((ActivitysAndCouponsByGoodsMsgModel.ResultDataBean.ActivitysBean) this.activitysBeanList.get(i)).getActivityInformation().getActivityType()) {
                    default:
                        this.stvActivity.setSubTitle("请选择");
                }
                for (; ; ) {
                    shouldShowCouponsBeanList.clear();
                    this.userCouponPrice = 0.0D;
                    this.userCouponId = 0;
                    if (((ActivitysAndCouponsByGoodsMsgModel.ResultDataBean.ActivitysBean) this.activitysBeanList.get(i)).getUserCouponMsgList() == null) {
                    }
                    int j = 0;
                    while (j < ((ActivitysAndCouponsByGoodsMsgModel.ResultDataBean.ActivitysBean) this.activitysBeanList.get(i)).getUserCouponMsgList().size()) {
                        this.couponsBean = new ActivitysAndCouponsByGoodsMsgModel.ResultDataBean.CouponsBean();
                        this.userCouponsBean1 = new ActivitysAndCouponsByGoodsMsgModel.ResultDataBean.CouponsBean.UserCouponsBean();
                        this.userCouponsBean1.setId(((ActivitysAndCouponsByGoodsMsgModel.ResultDataBean.ActivitysBean.UserCouponMsgListBean) ((ActivitysAndCouponsByGoodsMsgModel.ResultDataBean.ActivitysBean) this.activitysBeanList.get(i)).getUserCouponMsgList().get(j)).getUserCoupons().getId());
                        this.userCouponsBean1.setUserId(((ActivitysAndCouponsByGoodsMsgModel.ResultDataBean.ActivitysBean.UserCouponMsgListBean) ((ActivitysAndCouponsByGoodsMsgModel.ResultDataBean.ActivitysBean) this.activitysBeanList.get(i)).getUserCouponMsgList().get(j)).getUserCoupons().getUserId());
                        this.userCouponsBean1.setCouponInformationId(((ActivitysAndCouponsByGoodsMsgModel.ResultDataBean.ActivitysBean.UserCouponMsgListBean) ((ActivitysAndCouponsByGoodsMsgModel.ResultDataBean.ActivitysBean) this.activitysBeanList.get(i)).getUserCouponMsgList().get(j)).getUserCoupons().getCouponInformationId());
                        this.userCouponsBean1.setStatus(((ActivitysAndCouponsByGoodsMsgModel.ResultDataBean.ActivitysBean.UserCouponMsgListBean) ((ActivitysAndCouponsByGoodsMsgModel.ResultDataBean.ActivitysBean) this.activitysBeanList.get(i)).getUserCouponMsgList().get(j)).getUserCoupons().getStatus());
                        this.userCouponsBean1.setGetTime(((ActivitysAndCouponsByGoodsMsgModel.ResultDataBean.ActivitysBean.UserCouponMsgListBean) ((ActivitysAndCouponsByGoodsMsgModel.ResultDataBean.ActivitysBean) this.activitysBeanList.get(i)).getUserCouponMsgList().get(j)).getUserCoupons().getGetTime());
                        this.couponInformationBean = new ActivitysAndCouponsByGoodsMsgModel.ResultDataBean.CouponsBean.UserCouponsBean.CouponInformationBean();
                        this.couponInformationBean.setId(((ActivitysAndCouponsByGoodsMsgModel.ResultDataBean.ActivitysBean.UserCouponMsgListBean) ((ActivitysAndCouponsByGoodsMsgModel.ResultDataBean.ActivitysBean) this.activitysBeanList.get(i)).getUserCouponMsgList().get(j)).getUserCoupons().getCouponInformation().getId());
                        this.couponInformationBean.setIdentifier(((ActivitysAndCouponsByGoodsMsgModel.ResultDataBean.ActivitysBean.UserCouponMsgListBean) ((ActivitysAndCouponsByGoodsMsgModel.ResultDataBean.ActivitysBean) this.activitysBeanList.get(i)).getUserCouponMsgList().get(j)).getUserCoupons().getCouponInformation().getIdentifier());
                        this.couponInformationBean.setName(((ActivitysAndCouponsByGoodsMsgModel.ResultDataBean.ActivitysBean.UserCouponMsgListBean) ((ActivitysAndCouponsByGoodsMsgModel.ResultDataBean.ActivitysBean) this.activitysBeanList.get(i)).getUserCouponMsgList().get(j)).getUserCoupons().getCouponInformation().getName());
                        this.couponInformationBean.setPrice(((ActivitysAndCouponsByGoodsMsgModel.ResultDataBean.ActivitysBean.UserCouponMsgListBean) ((ActivitysAndCouponsByGoodsMsgModel.ResultDataBean.ActivitysBean) this.activitysBeanList.get(i)).getUserCouponMsgList().get(j)).getUserCoupons().getCouponInformation().getPrice());
                        this.couponInformationBean.setTotal(((ActivitysAndCouponsByGoodsMsgModel.ResultDataBean.ActivitysBean.UserCouponMsgListBean) ((ActivitysAndCouponsByGoodsMsgModel.ResultDataBean.ActivitysBean) this.activitysBeanList.get(i)).getUserCouponMsgList().get(j)).getUserCoupons().getCouponInformation().getTotal());
                        this.couponInformationBean.setUseLimit(((ActivitysAndCouponsByGoodsMsgModel.ResultDataBean.ActivitysBean.UserCouponMsgListBean) ((ActivitysAndCouponsByGoodsMsgModel.ResultDataBean.ActivitysBean) this.activitysBeanList.get(i)).getUserCouponMsgList().get(j)).getUserCoupons().getCouponInformation().getUseLimit());
                        this.couponInformationBean.setCount(((ActivitysAndCouponsByGoodsMsgModel.ResultDataBean.ActivitysBean.UserCouponMsgListBean) ((ActivitysAndCouponsByGoodsMsgModel.ResultDataBean.ActivitysBean) this.activitysBeanList.get(i)).getUserCouponMsgList().get(j)).getUserCoupons().getCouponInformation().getCount());
                        this.couponInformationBean.setState(((ActivitysAndCouponsByGoodsMsgModel.ResultDataBean.ActivitysBean.UserCouponMsgListBean) ((ActivitysAndCouponsByGoodsMsgModel.ResultDataBean.ActivitysBean) this.activitysBeanList.get(i)).getUserCouponMsgList().get(j)).getUserCoupons().getCouponInformation().getState());
                        this.couponInformationBean.setRules(((ActivitysAndCouponsByGoodsMsgModel.ResultDataBean.ActivitysBean.UserCouponMsgListBean) ((ActivitysAndCouponsByGoodsMsgModel.ResultDataBean.ActivitysBean) this.activitysBeanList.get(i)).getUserCouponMsgList().get(j)).getUserCoupons().getCouponInformation().getRules());
                        this.couponInformationBean.setBeginValidityTime(((ActivitysAndCouponsByGoodsMsgModel.ResultDataBean.ActivitysBean.UserCouponMsgListBean) ((ActivitysAndCouponsByGoodsMsgModel.ResultDataBean.ActivitysBean) this.activitysBeanList.get(i)).getUserCouponMsgList().get(j)).getUserCoupons().getCouponInformation().getBeginValidityTime());
                        this.couponInformationBean.setEndValidityTime(((ActivitysAndCouponsByGoodsMsgModel.ResultDataBean.ActivitysBean.UserCouponMsgListBean) ((ActivitysAndCouponsByGoodsMsgModel.ResultDataBean.ActivitysBean) this.activitysBeanList.get(i)).getUserCouponMsgList().get(j)).getUserCoupons().getCouponInformation().getEndValidityTime());
                        this.couponInformationBean.setBeginTime(((ActivitysAndCouponsByGoodsMsgModel.ResultDataBean.ActivitysBean.UserCouponMsgListBean) ((ActivitysAndCouponsByGoodsMsgModel.ResultDataBean.ActivitysBean) this.activitysBeanList.get(i)).getUserCouponMsgList().get(j)).getUserCoupons().getCouponInformation().getBeginTime());
                        this.couponInformationBean.setEndTime(((ActivitysAndCouponsByGoodsMsgModel.ResultDataBean.ActivitysBean.UserCouponMsgListBean) ((ActivitysAndCouponsByGoodsMsgModel.ResultDataBean.ActivitysBean) this.activitysBeanList.get(i)).getUserCouponMsgList().get(j)).getUserCoupons().getCouponInformation().getEndTime());
                        this.couponInformationBean.setOperatorIdentifier(((ActivitysAndCouponsByGoodsMsgModel.ResultDataBean.ActivitysBean.UserCouponMsgListBean) ((ActivitysAndCouponsByGoodsMsgModel.ResultDataBean.ActivitysBean) this.activitysBeanList.get(i)).getUserCouponMsgList().get(j)).getUserCoupons().getCouponInformation().getOperatorIdentifier());
                        this.couponInformationBean.setOperatorTime(((ActivitysAndCouponsByGoodsMsgModel.ResultDataBean.ActivitysBean.UserCouponMsgListBean) ((ActivitysAndCouponsByGoodsMsgModel.ResultDataBean.ActivitysBean) this.activitysBeanList.get(i)).getUserCouponMsgList().get(j)).getUserCoupons().getCouponInformation().getOperatorTime());
                        this.userCouponsBean1.setCouponInformation(this.couponInformationBean);
                        this.couponsBean.setUserCoupons(this.userCouponsBean1);
                        this.couponsBean.setAfterDiscountMoney(((ActivitysAndCouponsByGoodsMsgModel.ResultDataBean.ActivitysBean.UserCouponMsgListBean) ((ActivitysAndCouponsByGoodsMsgModel.ResultDataBean.ActivitysBean) this.activitysBeanList.get(i)).getUserCouponMsgList().get(j)).getAfterDiscountMoney());
                        shouldShowCouponsBeanList.add(this.couponsBean);
                        j += 1;
                    }
                    this.discount = ((ActivitysAndCouponsByGoodsMsgModel.ResultDataBean.ActivitysBean) this.activitysBeanList.get(i)).getActivityInformation().getDiscount();
                    this.stvActivity.setSubTitle("折扣");
                    j = 0;
                    int k;
                    HashMap localHashMap;
                    double d1;
                    int m;
                    double d2;
                    int n;
                    if (j < shouldBuyShoppingCartList.size()) {
                        k = 0;
                        if (k < this.goodsSpeIdList.size()) {
                            if (((ShoppingCartModel.ResultDataBean) shouldBuyShoppingCartList.get(j)).getGoodsSpecificationDetailsId() != ((Integer) this.goodsSpeIdList.get(k)).intValue()) {
                            }
                            localHashMap = new HashMap();
                            localHashMap.put("goodsSpecId", this.goodsSpeIdList.get(k));
                            d1 = ((ShoppingCartModel.ResultDataBean) shouldBuyShoppingCartList.get(j)).getGoodsUnitlPrice();
                            m = ((ShoppingCartModel.ResultDataBean) shouldBuyShoppingCartList.get(j)).getGoodsNum();
                            d2 = ((ActivitysAndCouponsByGoodsMsgModel.ResultDataBean.ActivitysBean) this.activitysBeanList.get(i)).getActivityInformation().getDiscount();
                            this.maxNum = ((ActivitysAndCouponsByGoodsMsgModel.ResultDataBean.ActivitysBean) this.activitysBeanList.get(i)).getActivityInformation().getMaxNum();
                            if (((ActivitysAndCouponsByGoodsMsgModel.ResultDataBean.ActivitysBean) this.activitysBeanList.get(i)).getActivityInformation().getMaxNum() < ((ShoppingCartModel.ResultDataBean) shouldBuyShoppingCartList.get(j)).getGoodsNum()) {
                            }
                            d1 = Double.parseDouble(this.df.format(m * d1 * d2));
                            localHashMap.put("afterActivityGoodsPrice", Double.valueOf(d1));
                            this.goodsSpecPayMoney.add(localHashMap);
                            this.afterActivityTotalMoney += d1;
                            if (k == this.goodsSpeIdList.size()) {
                                this.afterActivityTotalMoney += Double.parseDouble(this.df.format(((ShoppingCartModel.ResultDataBean) shouldBuyShoppingCartList.get(j)).getGoodsUnitlPrice() * ((ShoppingCartModel.ResultDataBean) shouldBuyShoppingCartList.get(j)).getGoodsNum()));
                            }
                            j += 1;
                            n = ((ActivitysAndCouponsByGoodsMsgModel.ResultDataBean.ActivitysBean) this.activitysBeanList.get(i)).getActivityInformation().getMaxNum();
                            d1 = Double.parseDouble(this.df.format(n * d1 * d2 + (m - n) * d1));
                            localHashMap.put("afterActivityGoodsPrice", Double.valueOf(d1));
                            k += 1;
                        }
                    }
                    if (this.afterActivityTotalMoney < 0.0D) {
                        this.tvTotal.setText(0.0D + this.postage + "");
                    } else {
                        if (this.afterActivityTotalMoney + this.postage > 1.0D) {
                            this.tvTotal.setText(this.df.format(this.afterActivityTotalMoney + this.postage) + "");
                        } else {
                            if (this.afterActivityTotalMoney < 50000.0D) {
                            }
                            this.tvSubmitPrompt.setVisibility(View.VISIBLE);
                            this.tvSubmitPrompt.setText(R.string.text_submit_order_money_5);
                            this.stvPaymentType.setSubTitle("线下支付");
                            this.offlinePayerMsg.setVisibility(View.VISIBLE);
                            this.payType = 1;
                            this.tvTotal.setText(Double.parseDouble(this.df.format(this.afterActivityTotalMoney + this.postage)) + "");
                        }
                        if (this.isPresell == 1) {
                            this.tvSubmitPrompt.setVisibility(View.VISIBLE);
                        } else {
                            this.stvPaymentType.setSubTitle("在线支付");
                            this.offlinePayerMsg.setVisibility(View.GONE);
                            this.payType = 0;
                            this.tvSubmitPrompt.setVisibility(View.GONE);
                        }
                        this.discount = ((ActivitysAndCouponsByGoodsMsgModel.ResultDataBean.ActivitysBean) this.activitysBeanList.get(i)).getActivityInformation().getDiscount();
                        this.stvActivity.setSubTitle("团购");
                        j = 0;
                        if (j < shouldBuyShoppingCartList.size()) {
                            k = 0;

                            if (k < this.goodsSpeIdList.size()) {
                                if (((ShoppingCartModel.ResultDataBean) shouldBuyShoppingCartList.get(j)).getGoodsSpecificationDetailsId() != ((Integer) this.goodsSpeIdList.get(k)).intValue()) {
                                }
                                localHashMap = new HashMap();
                                localHashMap.put("goodsSpecId", this.goodsSpeIdList.get(k));
                                d1 = ((ShoppingCartModel.ResultDataBean) shouldBuyShoppingCartList.get(j)).getGoodsUnitlPrice();
                                m = ((ShoppingCartModel.ResultDataBean) shouldBuyShoppingCartList.get(j)).getGoodsNum();
                                d2 = ((ActivitysAndCouponsByGoodsMsgModel.ResultDataBean.ActivitysBean) this.activitysBeanList.get(i)).getActivityInformation().getDiscount();
                                this.maxNum = ((ActivitysAndCouponsByGoodsMsgModel.ResultDataBean.ActivitysBean) this.activitysBeanList.get(i)).getActivityInformation().getMaxNum();
                                if (((ActivitysAndCouponsByGoodsMsgModel.ResultDataBean.ActivitysBean) this.activitysBeanList.get(i)).getActivityInformation().getMaxNum() < ((ShoppingCartModel.ResultDataBean) shouldBuyShoppingCartList.get(j)).getGoodsNum()) {
                                }
                                d1 = Double.parseDouble(this.df.format(m * d2));
                                localHashMap.put("afterActivityGoodsPrice", Double.valueOf(d1));
                                this.goodsSpecPayMoney.add(localHashMap);
                                this.afterActivityTotalMoney += d1;
                                if (k == this.goodsSpeIdList.size()) {
                                    this.afterActivityTotalMoney += Double.parseDouble(this.df.format(((ShoppingCartModel.ResultDataBean) shouldBuyShoppingCartList.get(j)).getGoodsUnitlPrice() * ((ShoppingCartModel.ResultDataBean) shouldBuyShoppingCartList.get(j)).getGoodsNum()));
                                }
                                j += 1;
                                n = ((ActivitysAndCouponsByGoodsMsgModel.ResultDataBean.ActivitysBean) this.activitysBeanList.get(i)).getActivityInformation().getMaxNum();
                                d1 = Double.parseDouble(this.df.format(n * d2 + (m - n) * d1));
                                localHashMap.put("afterActivityGoodsPrice", Double.valueOf(d1));
                                k += 1;
                            }
                        }
                        if (this.afterActivityTotalMoney < 0.0D) {
                            this.tvTotal.setText(0.0D + this.postage + "");
                        } else {
                            if (this.afterActivityTotalMoney + this.postage > 1.0D) {
                                this.tvTotal.setText(this.df.format(this.afterActivityTotalMoney + this.postage) + "");
                            } else {
                                if (this.afterActivityTotalMoney < 50000.0D) {
                                }
                                this.tvSubmitPrompt.setVisibility(View.VISIBLE);
                                this.tvSubmitPrompt.setText(R.string.text_submit_order_money_5);
                                this.stvPaymentType.setSubTitle("线下支付");
                                this.offlinePayerMsg.setVisibility(View.VISIBLE);
                                this.payType = 1;
                                this.tvTotal.setText(Double.parseDouble(this.df.format(this.afterActivityTotalMoney + this.postage)) + "");
                            }
                            if (this.isPresell == 1) {
                                this.tvSubmitPrompt.setVisibility(View.VISIBLE);
                            } else {
                                this.stvPaymentType.setSubTitle("在线支付");
                                this.offlinePayerMsg.setVisibility(View.GONE);
                                this.payType = 0;
                                this.tvSubmitPrompt.setVisibility(View.GONE);
                            }
                            this.discount = ((ActivitysAndCouponsByGoodsMsgModel.ResultDataBean.ActivitysBean) this.activitysBeanList.get(i)).getActivityInformation().getDiscount();
                            this.stvActivity.setSubTitle("秒杀");
                            j = 0;
                            if (j < shouldBuyShoppingCartList.size()) {
                                k = 0;
                                if (k < this.goodsSpeIdList.size()) {
                                    if (((ShoppingCartModel.ResultDataBean) shouldBuyShoppingCartList.get(j)).getGoodsSpecificationDetailsId() != ((Integer) this.goodsSpeIdList.get(k)).intValue()) {
                                    }
                                    localHashMap = new HashMap();
                                    localHashMap.put("goodsSpecId", this.goodsSpeIdList.get(k));
                                    d1 = ((ShoppingCartModel.ResultDataBean) shouldBuyShoppingCartList.get(j)).getGoodsUnitlPrice();
                                    m = ((ShoppingCartModel.ResultDataBean) shouldBuyShoppingCartList.get(j)).getGoodsNum();
                                    d2 = ((ActivitysAndCouponsByGoodsMsgModel.ResultDataBean.ActivitysBean) this.activitysBeanList.get(i)).getActivityInformation().getDiscount();
                                    this.maxNum = ((ActivitysAndCouponsByGoodsMsgModel.ResultDataBean.ActivitysBean) this.activitysBeanList.get(i)).getActivityInformation().getMaxNum();
                                    if (((ActivitysAndCouponsByGoodsMsgModel.ResultDataBean.ActivitysBean) this.activitysBeanList.get(i)).getActivityInformation().getMaxNum() < ((ShoppingCartModel.ResultDataBean) shouldBuyShoppingCartList.get(j)).getGoodsNum()) {
                                    }
                                    d1 = Double.parseDouble(this.df.format(m * d2));
                                    localHashMap.put("afterActivityGoodsPrice", Double.valueOf(d1));
                                    this.goodsSpecPayMoney.add(localHashMap);
                                    this.afterActivityTotalMoney += d1;
                                    if (k == this.goodsSpeIdList.size()) {
                                        this.afterActivityTotalMoney += Double.parseDouble(this.df.format(((ShoppingCartModel.ResultDataBean) shouldBuyShoppingCartList.get(j)).getGoodsUnitlPrice() * ((ShoppingCartModel.ResultDataBean) shouldBuyShoppingCartList.get(j)).getGoodsNum()));
                                    }
                                    j += 1;
                                    n = ((ActivitysAndCouponsByGoodsMsgModel.ResultDataBean.ActivitysBean) this.activitysBeanList.get(i)).getActivityInformation().getMaxNum();
                                    d1 = Double.parseDouble(this.df.format(n * d2 + (m - n) * d1));
                                    localHashMap.put("afterActivityGoodsPrice", Double.valueOf(d1));
                                    k += 1;
                                }
                            }
                            if (this.afterActivityTotalMoney < 0.0D) {
                                this.tvTotal.setText(0.0D + this.postage + "");
                            } else {
                                if (this.afterActivityTotalMoney + this.postage > 1.0D) {
                                    this.tvTotal.setText(this.df.format(this.afterActivityTotalMoney + this.postage) + "");
                                } else {
                                    if (this.afterActivityTotalMoney < 50000.0D) {
                                    }
                                    this.tvSubmitPrompt.setVisibility(View.VISIBLE);
                                    this.tvSubmitPrompt.setText(R.string.text_submit_order_money_5);
                                    this.stvPaymentType.setSubTitle("线下支付");
                                    this.offlinePayerMsg.setVisibility(View.VISIBLE);
                                    this.payType = 1;
                                    this.tvTotal.setText(Double.parseDouble(this.df.format(this.afterActivityTotalMoney + this.postage)) + "");
                                }
                                if (this.isPresell == 1) {
                                    this.tvSubmitPrompt.setVisibility(View.VISIBLE);
                                } else {
                                    this.stvPaymentType.setSubTitle("在线支付");
                                    this.offlinePayerMsg.setVisibility(View.GONE);
                                    this.payType = 0;
                                    this.tvSubmitPrompt.setVisibility(View.GONE);
                                }
                                this.discount = ((ActivitysAndCouponsByGoodsMsgModel.ResultDataBean.ActivitysBean) this.activitysBeanList.get(i)).getActivityInformation().getDiscount();
                                this.stvActivity.setSubTitle("立减");
                                j = 0;
                                if (j < shouldBuyShoppingCartList.size()) {
                                    k = 0;
                                    for (; ; ) {
                                        if (k < this.goodsSpeIdList.size()) {
                                            if (((ShoppingCartModel.ResultDataBean) shouldBuyShoppingCartList.get(j)).getGoodsSpecificationDetailsId() == ((Integer) this.goodsSpeIdList.get(k)).intValue()) {
                                                localHashMap = new HashMap();
                                                localHashMap.put("goodsSpecId", this.goodsSpeIdList.get(k));
                                                d1 = ((ShoppingCartModel.ResultDataBean) shouldBuyShoppingCartList.get(j)).getGoodsUnitlPrice();
                                                m = ((ShoppingCartModel.ResultDataBean) shouldBuyShoppingCartList.get(j)).getGoodsNum();
                                                d2 = ((ActivitysAndCouponsByGoodsMsgModel.ResultDataBean.ActivitysBean) this.activitysBeanList.get(i)).getActivityInformation().getDiscount();
                                                this.maxNum = ((ActivitysAndCouponsByGoodsMsgModel.ResultDataBean.ActivitysBean) this.activitysBeanList.get(i)).getActivityInformation().getMaxNum();
                                                d1 = Double.parseDouble(this.df.format(m * d1 - d2));
                                                localHashMap.put("afterActivityGoodsPrice", Double.valueOf(d1));
                                                this.goodsSpecPayMoney.add(localHashMap);
                                                this.afterActivityTotalMoney += d1;
                                            }
                                        } else {
                                            if (k == this.goodsSpeIdList.size()) {
                                                this.afterActivityTotalMoney += Double.parseDouble(this.df.format(((ShoppingCartModel.ResultDataBean) shouldBuyShoppingCartList.get(j)).getGoodsUnitlPrice() * ((ShoppingCartModel.ResultDataBean) shouldBuyShoppingCartList.get(j)).getGoodsNum()));
                                            }
                                            j += 1;
                                            break;
                                        }
                                        k += 1;
                                    }
                                }
                                if (this.afterActivityTotalMoney < 0.0D) {
                                    this.tvTotal.setText(0.0D + this.postage + "");
                                } else {
                                    if (this.afterActivityTotalMoney + this.postage > 1.0D) {
                                        this.tvTotal.setText(this.df.format(this.afterActivityTotalMoney + this.postage) + "");
                                    } else {
                                        if (this.afterActivityTotalMoney < 50000.0D) {
                                        }
                                        this.tvSubmitPrompt.setVisibility(View.VISIBLE);
                                        this.tvSubmitPrompt.setText(R.string.text_submit_order_money_5);
                                        this.stvPaymentType.setSubTitle("线下支付");
                                        this.offlinePayerMsg.setVisibility(View.VISIBLE);
                                        this.payType = 1;
                                        this.tvTotal.setText(Double.parseDouble(this.df.format(this.afterActivityTotalMoney + this.postage)) + "");
                                    }
                                    if (this.isPresell == 1) {
                                        this.tvSubmitPrompt.setVisibility(View.VISIBLE);
                                    } else {
                                        this.stvPaymentType.setSubTitle("在线支付");
                                        this.offlinePayerMsg.setVisibility(View.GONE);
                                        this.payType = 0;
                                        this.tvSubmitPrompt.setVisibility(View.GONE);
                                    }
                                    this.thresholdPrice = ((ActivitysAndCouponsByGoodsMsgModel.ResultDataBean.ActivitysBean) this.activitysBeanList.get(i)).getActivityInformation().getPrice();
                                    this.discount = ((ActivitysAndCouponsByGoodsMsgModel.ResultDataBean.ActivitysBean) this.activitysBeanList.get(i)).getActivityInformation().getDiscount();
                                    this.stvActivity.setSubTitle("满减");
                                    j = 0;
                                    if (j < shouldBuyShoppingCartList.size()) {
                                        k = 0;
                                        for (; ; ) {
                                            if (k < this.goodsSpeIdList.size()) {
                                                if (((ShoppingCartModel.ResultDataBean) shouldBuyShoppingCartList.get(j)).getGoodsSpecificationDetailsId() == ((Integer) this.goodsSpeIdList.get(k)).intValue()) {
                                                    localHashMap = new HashMap();
                                                    localHashMap.put("goodsSpecId", this.goodsSpeIdList.get(k));
                                                    d1 = ((ShoppingCartModel.ResultDataBean) shouldBuyShoppingCartList.get(j)).getGoodsUnitlPrice();
                                                    m = ((ShoppingCartModel.ResultDataBean) shouldBuyShoppingCartList.get(j)).getGoodsNum();
                                                    d2 = ((ActivitysAndCouponsByGoodsMsgModel.ResultDataBean.ActivitysBean) this.activitysBeanList.get(i)).getActivityInformation().getDiscount();
                                                    d1 = Double.parseDouble(this.df.format(m * d1 - d2));
                                                    localHashMap.put("afterActivityGoodsPrice", Double.valueOf(d1));
                                                    this.goodsSpecPayMoney.add(localHashMap);
                                                    this.afterActivityTotalMoney += d1;
                                                }
                                            } else {
                                                if (k == this.goodsSpeIdList.size()) {
                                                    this.afterActivityTotalMoney += Double.parseDouble(this.df.format(((ShoppingCartModel.ResultDataBean) shouldBuyShoppingCartList.get(j)).getGoodsUnitlPrice() * ((ShoppingCartModel.ResultDataBean) shouldBuyShoppingCartList.get(j)).getGoodsNum()));
                                                }
                                                j += 1;
                                                break;
                                            }
                                            k += 1;
                                        }
                                    }
                                    if (this.afterActivityTotalMoney >= 0.0D) {
                                        break;
                                    }
                                    this.tvTotal.setText(0.0D + this.postage + "");
                                }
                            }
                        }
                    }
                }
                if (this.afterActivityTotalMoney + this.postage > 1.0D) {
                    this.tvTotal.setText(this.df.format(this.afterActivityTotalMoney + this.postage) + "");
                } else {
                    if (this.afterActivityTotalMoney < 50000.0D) {
                    }
                    this.tvSubmitPrompt.setVisibility(View.VISIBLE);
                    this.tvSubmitPrompt.setText(R.string.text_submit_order_money_5);
                    this.stvPaymentType.setSubTitle("线下支付");
                    this.offlinePayerMsg.setVisibility(View.VISIBLE);
                    this.payType = 1;
                    this.tvTotal.setText(Double.parseDouble(this.df.format(this.afterActivityTotalMoney + this.postage)) + "");
                }
                if (this.isPresell == 1) {
                    this.tvSubmitPrompt.setVisibility(View.VISIBLE);
                } else {
                    this.stvPaymentType.setSubTitle("在线支付");
                    this.offlinePayerMsg.setVisibility(View.GONE);
                    this.payType = 0;
                    this.tvSubmitPrompt.setVisibility(View.GONE);
                }
                if (shouldShowCouponsBeanList.size() != 0) {
                }
                this.llStvCoupon.setVisibility(View.GONE);
                this.stvCoupon.setSubTitle("暂无优惠券");
            } else {
                i += 1;
                this.llStvCoupon.setVisibility(View.VISIBLE);
                this.stvCoupon.setSubTitle("请选择");
            }
        }
    }

    public void onClickBottomOkBtn(String paramString) {
        this.stvIstributionTime.setSubTitle(paramString);
        this.chooseSendToTimePopu.dismiss();
    }

    protected void onCreate(@Nullable Bundle paramBundle) {
        super.onCreate(paramBundle);
        setContentView(R.layout.activity_order_submit);
        ButterKnife.bind(this);
        this.df = new DecimalFormat(".00");
        this.offlinePayerPhone.setInputType(3);
        this.userId = getSharedPreferences("JLAppData", 0).getInt("userId", 0);
        if (this.userId > 0) {
            buildProgressDialog();
            Intent intent = getIntent();
            this.isFromWhichPage = intent.getIntExtra("isFromWhichPage", -1);
            if (this.isFromWhichPage == 0) {
                this.buyGoodsMsg = intent.getIntArrayExtra("shopCartIds");
                this.isPresell = intent.getIntExtra("isPresell", 0);
                this.activityId = intent.getIntExtra("activityId", 0);
                Log.d("aaaaaaaa", "shopCartIds.size:" + this.buyGoodsMsg.length);
                if ((this.buyGoodsMsg != null) && (this.buyGoodsMsg.length > 0)) {
                    getShoppingCartByUserId(Integer.valueOf(this.userId));
                    setListener();
                    if (this.isPresell != 1) {
                    }
                    this.stvIstributionTime.setSubTitle("预售活动结束后7天内");
                }
            } else {
                this.stvCoupon.setSubTitle("请选择");
                this.stvInvoice.setSubTitle("不开发票");
                Toast.makeText(this, "抱歉，数据出错啦!", Toast.LENGTH_SHORT).show();
                if (this.isFromWhichPage != 1) {
                }
                this.buyNumFromGoodsDetailPage = intent.getIntExtra("buyNum", 1);
                this.goodsSpecIdFromGoodsDetailPage = intent.getIntExtra("goodsSpecId", 0);
                this.goodsIdFromGoodsDetailPage = intent.getIntExtra("goodsId", 0);
                this.isPresell = intent.getIntExtra("isPresell", 0);
                this.activityId = intent.getIntExtra("activityId", 0);
                Log.d("aaaaordersubmit", "goodsId:" + this.goodsIdFromGoodsDetailPage + " goodsSpecId:" + this.goodsSpecIdFromGoodsDetailPage + " buyNum:" + this.buyNumFromGoodsDetailPage);
                if ((this.goodsIdFromGoodsDetailPage != 0) && (this.goodsSpecIdFromGoodsDetailPage != 0)) {
                    getGoodsDetailMsgByGoodsId(this.goodsIdFromGoodsDetailPage);
                }
                Toast.makeText(this, "抱歉，数据出错啦!", Toast.LENGTH_SHORT).show();
                this.stvIstributionTime.setSubTitle("请选择");
            }
        }
        Toast.makeText(this, "您还未登录，请先登录。", Toast.LENGTH_SHORT).show();
        startActivity(new Intent(this, LoginActivity.class));
    }

    protected void onResume() {
        super.onResume();
        Log.d("aaaaaaaGoods", "onResume");
        getShippingAddressByUserId();
    }

    public void saveMsgToGetAvticityAndCoupon(List<ShoppingCartModel.ResultDataBean> paramList) {
        this.paramForGetActivitysAndCouponsByGoodsMsg = new ParamForGetActivitysAndCouponsByGoodsMsg();
        this.goodsMsgListBeans = new ArrayList();
        this.goodsActivityListBeans = new ArrayList();
        this.goodsSpeActivityListBeans = new ArrayList();
        int i = 0;
        while (i < paramList.size()) {
            this.goodsMsgListBean = new GoodsMsgListBean();
            this.goodsSpeActivityListBeans = new ArrayList();
            this.goodsActivityListBeans = new ArrayList();
            if (((ShoppingCartModel.ResultDataBean) paramList.get(i)).getGoodsDetails() != null) {
                int j;
                Object localObject;
                if (((ShoppingCartModel.ResultDataBean) paramList.get(i)).getGoodsDetails().getGoodsActivitys().size() > 0) {
                    j = 0;
                    while (j < ((ShoppingCartModel.ResultDataBean) paramList.get(i)).getGoodsDetails().getGoodsActivitys().size()) {
                        localObject = (ShoppingCartModel.ResultDataBean.GoodsDetailsBean.GoodsActivitysBeanX) ((ShoppingCartModel.ResultDataBean) paramList.get(i)).getGoodsDetails().getGoodsActivitys().get(j);
                        this.goodsActivityListBean = new GoodsActivityListBean();
                        this.goodsActivityListBean.setId(((ShoppingCartModel.ResultDataBean.GoodsDetailsBean.GoodsActivitysBeanX) localObject).getActivityInformation().getId());
                        this.goodsActivityListBean.setName(((ShoppingCartModel.ResultDataBean.GoodsDetailsBean.GoodsActivitysBeanX) localObject).getActivityInformation().getName());
                        this.goodsActivityListBean.setActivityType(((ShoppingCartModel.ResultDataBean.GoodsDetailsBean.GoodsActivitysBeanX) localObject).getActivityInformation().getActivityType());
                        this.goodsActivityListBean.setPrice(((ShoppingCartModel.ResultDataBean.GoodsDetailsBean.GoodsActivitysBeanX) localObject).getActivityInformation().getPrice());
                        this.goodsActivityListBean.setDiscount(((ShoppingCartModel.ResultDataBean.GoodsDetailsBean.GoodsActivitysBeanX) localObject).getActivityInformation().getDiscount());
                        this.goodsActivityListBean.setMaxNum(((ShoppingCartModel.ResultDataBean.GoodsDetailsBean.GoodsActivitysBeanX) localObject).getActivityInformation().getMaxNum());
                        this.goodsActivityListBean.setBeginValidityTime(((ShoppingCartModel.ResultDataBean.GoodsDetailsBean.GoodsActivitysBeanX) localObject).getActivityInformation().getBeginValidityTime());
                        this.goodsActivityListBean.setEndValidityTime(((ShoppingCartModel.ResultDataBean.GoodsDetailsBean.GoodsActivitysBeanX) localObject).getActivityInformation().getEndValidityTime());
                        this.goodsActivityListBean.setState(((ShoppingCartModel.ResultDataBean.GoodsDetailsBean.GoodsActivitysBeanX) localObject).getActivityInformation().getState());
                        this.goodsActivityListBeans.add(this.goodsActivityListBean);
                        j += 1;
                    }
                }
                this.goodsMsgListBean.setGoodsActivityList(this.goodsActivityListBeans);
                Log.d("aaaaaaaaaaaaa", "goodsActivityListBeans.size:" + this.goodsActivityListBeans.size());
                if (((ShoppingCartModel.ResultDataBean) paramList.get(i)).getGoodsDetails().getGoodsSpecificationDetails().size() > 0) {
                    j = 0;
                    while (j < ((ShoppingCartModel.ResultDataBean) paramList.get(i)).getGoodsDetails().getGoodsSpecificationDetails().size()) {
                        if ((((ShoppingCartModel.ResultDataBean) paramList.get(i)).getGoodsSpecificationDetailsId() == ((ShoppingCartModel.ResultDataBean.GoodsDetailsBean.GoodsSpecificationDetailsBean) ((ShoppingCartModel.ResultDataBean) paramList.get(i)).getGoodsDetails().getGoodsSpecificationDetails().get(j)).getId()) && (((ShoppingCartModel.ResultDataBean.GoodsDetailsBean.GoodsSpecificationDetailsBean) ((ShoppingCartModel.ResultDataBean) paramList.get(i)).getGoodsDetails().getGoodsSpecificationDetails().get(j)).getGoodsActivitys().size() > 0)) {
                            int k = 0;
                            while (k < ((ShoppingCartModel.ResultDataBean.GoodsDetailsBean.GoodsSpecificationDetailsBean) ((ShoppingCartModel.ResultDataBean) paramList.get(i)).getGoodsDetails().getGoodsSpecificationDetails().get(j)).getGoodsActivitys().size()) {
                                localObject = (ShoppingCartModel.ResultDataBean.GoodsDetailsBean.GoodsSpecificationDetailsBean.GoodsActivitysBean) ((ShoppingCartModel.ResultDataBean.GoodsDetailsBean.GoodsSpecificationDetailsBean) ((ShoppingCartModel.ResultDataBean) paramList.get(i)).getGoodsDetails().getGoodsSpecificationDetails().get(j)).getGoodsActivitys().get(k);
                                this.goodsSpeActivityListBean = new GoodsSpeActivityListBean();
                                this.goodsSpeActivityListBean.setId(((ShoppingCartModel.ResultDataBean.GoodsDetailsBean.GoodsSpecificationDetailsBean.GoodsActivitysBean) localObject).getActivityInformation().getId());
                                this.goodsSpeActivityListBean.setName(((ShoppingCartModel.ResultDataBean.GoodsDetailsBean.GoodsSpecificationDetailsBean.GoodsActivitysBean) localObject).getActivityInformation().getName());
                                this.goodsSpeActivityListBean.setActivityType(((ShoppingCartModel.ResultDataBean.GoodsDetailsBean.GoodsSpecificationDetailsBean.GoodsActivitysBean) localObject).getActivityInformation().getActivityType());
                                this.goodsSpeActivityListBean.setPrice(((ShoppingCartModel.ResultDataBean.GoodsDetailsBean.GoodsSpecificationDetailsBean.GoodsActivitysBean) localObject).getActivityInformation().getPrice());
                                this.goodsSpeActivityListBean.setDiscount(((ShoppingCartModel.ResultDataBean.GoodsDetailsBean.GoodsSpecificationDetailsBean.GoodsActivitysBean) localObject).getActivityInformation().getDiscount());
                                this.goodsSpeActivityListBean.setMaxNum(((ShoppingCartModel.ResultDataBean.GoodsDetailsBean.GoodsSpecificationDetailsBean.GoodsActivitysBean) localObject).getActivityInformation().getMaxNum());
                                this.goodsSpeActivityListBean.setBeginValidityTime(((ShoppingCartModel.ResultDataBean.GoodsDetailsBean.GoodsSpecificationDetailsBean.GoodsActivitysBean) localObject).getActivityInformation().getBeginValidityTime());
                                this.goodsSpeActivityListBean.setEndValidityTime(((ShoppingCartModel.ResultDataBean.GoodsDetailsBean.GoodsSpecificationDetailsBean.GoodsActivitysBean) localObject).getActivityInformation().getEndValidityTime());
                                this.goodsSpeActivityListBean.setState(((ShoppingCartModel.ResultDataBean.GoodsDetailsBean.GoodsSpecificationDetailsBean.GoodsActivitysBean) localObject).getActivityInformation().getState());
                                this.goodsSpeActivityListBeans.add(this.goodsSpeActivityListBean);
                                k += 1;
                            }
                        }
                        j += 1;
                    }
                    this.goodsMsgListBean.setGoodsSpeActivityList(this.goodsSpeActivityListBeans);
                    Log.d("aaaaaaaaaaaaa", "goodsSpeActivityListBeans.size:" + this.goodsSpeActivityListBeans.size());
                }
            }
            this.goodsMsgListBean.setGoodsSpeId(((ShoppingCartModel.ResultDataBean) paramList.get(i)).getGoodsSpecificationDetailsId());
            this.goodsMsgListBean.setNumber(((ShoppingCartModel.ResultDataBean) paramList.get(i)).getGoodsNum());
            this.goodsMsgListBean.setUnitPrice(((ShoppingCartModel.ResultDataBean) paramList.get(i)).getGoodsUnitlPrice());
            this.goodsMsgListBeans.add(this.goodsMsgListBean);
            i += 1;
        }
        this.paramForGetActivitysAndCouponsByGoodsMsg.setGoodsMsgList(this.goodsMsgListBeans);
        this.paramForGetActivitysAndCouponsByGoodsMsg.setUserId(this.userId);
        Log.d("aaaaaaaaaaaaa", "saveMsgToGetAvticityAndCoupon.userId:" + this.paramForGetActivitysAndCouponsByGoodsMsg.getUserId() + " msgList:" + this.paramForGetActivitysAndCouponsByGoodsMsg.getGoodsMsgList().size());
        getActivitysAndCouponsByGoodsMsg(this.paramForGetActivitysAndCouponsByGoodsMsg);
    }
}


/* Location:              /Users/davidzhang/Documents/decompileApk/jlfood-dex2jar.jar!/com/jl/jlapp/mvp/activity/OrderSubmitActivity.class
 * Java compiler version: 6 (50.0)
 * JD-Core Version:       0.7.1
 */